Any changes in JavaMail Api
Hi
Is their any change in javamail api with the release of SE 6.
When was javamail api last updated or changed.
null
JavaMail will work fine on Java SE 6.
JavaMail was last updated about a year ago.
Similar Messages
-
X.400 instead of SMTP Protocol and Javamail API
We have developed a workflow application on Domino 5.0.7. The SmartHost is "MS Exchange Server", because the application will only be accessed by browsers, we are using javaagent to send the email notifications. Due to some domain restrictions on MS Exhchange servers we have implemented Javamail API on the domino server, and it worked fine (I mean the messages were received by the Exchange Clients, using the SMTP addresses like [email protected]). As we dont have available SMTP addresses for all end users in the company we need to use the X.400 addresses. Is there anyone, can help guide about either the avaiability of any X.400 javamail api, or how to use mapi etc? I know it is little bit challenging, but we are struck. thanks
Currently, the latest version of the JavaMail 1.2 API, X.400 transport protocol is not supported yet. Only the transport SMTP - a message Transport protocol, for sending messages to a server, is supported.
Allen Lai
SUN Developer Technical Support -
Problem Sending mails in a loop using JavaMail API
Hello All,
I am sending emails in a loop(one after the other) using JavaMail API,but the problem is, if the first two,three email addresses in the loop are Valid it sends the Email Properly, but if the Fourth or so is Invalid Address it throws an Exception....
"javax.mail.SendFailedException: Sending failed;"
nested exception is:
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
javax.mail.SendFailedException: 450 <[email protected]>:Recipient address rejected: Domain not found......
So if i want to send hundereds of emails and if one of the Emails inbetween is Invalid the process Stops at that point and i could not send the other emails in the Loop......
How Could i Trap the exception thrown and handle it in such a way, so that the loops continues ..
Is there something with the SMTP Server....?
The code which i am using is as follows....
<Code>...
try {
InitialContext ic = new InitialContext();
Session session = (Session) ic.lookup(JNDINames.MAIL_SESSION);
if (Debug.debuggingOn)
session.setDebug(true);
// construct the message
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(eMess.getEmailSender()));
String to = "";
msg.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(to, false));
msg.setRecipients(Message.RecipientType.BCC,
InternetAddress.parse(eMess.getEmailReceiver(), false));
msg.setSubject(eMess.getSubject());
msg.setContent(eMess.getHtmlContents(),"text/plain");
msg.saveChanges();
Transport.send(msg);
} catch (Exception e) {
Debug.print("createAndSendMail exception : " + e);
throw new MailerAppException("Failure while sending mail");
</Code>....
Please give me any suggestions regarding it....and guide me accordingly..
Thanks a million in advance...
Regards
SamHow about something like the code attached here. Be aware it is lifted and edited out of an app we have here so it may require changing to get it to work. If it don't work - don't come asking for help as this is only a rough example of one way of doing it. RTFM - that's how we worked it out!
SH
try {
Transport.send(msg);
// If we get to here then the mail went OK so update all the records in the email as sent
System.out.println("Email sent OK");
catch (MessagingException mex) {
System.out.println("Message error");
Exception ex = mex;
do {
if (ex instanceof SendFailedException) {
if (ex.getMessage().startsWith("Sending failed")) {
// Ignore this message as we want to know the real reason for failure
// If we get an Invalid Address error or a Message partially delivered message process the message
if (ex.getMessage().startsWith("Message partially delivered")
|| ex.getMessage().startsWith("Invalid Addresses")) {
// This message is of interest as we need to process the actual individual addresses
System.out.println(ex.getMessage().substring(0, ex.getMessage().indexOf(";")));
// Now get the addresses from the SendFailedException
SendFailedException sfex = (SendFailedException) ex;
Address[] invalid = sfex.getInvalidAddresses();
if (invalid != null) {
System.out.println("Invalid Addresse(s) found -");
if (invalid.length > 0) {
for (int x = 0; x < invalid.length; x++) {
System.out.println(invalid[x].toString().trim());
Address[] validUnsent = sfex.getValidUnsentAddresses();
if (validUnsent != null) {
System.out.println("Valid Unsent Addresses found -");
if (validUnsent.length > 0) {
for (int x = 0; x < validUnsent.length; x++) {
System.out.println(validUnsent[x].toString().trim());
Address[] validSent = sfex.getValidSentAddresses();
if (validSent != null) {
System.out.println("Valid Sent Addresses found -");
if (validSent.length > 0) {
for (int x = 0; x < validSent.length; x++) {
System.out.println(validSent[x].toString().trim());
if (ex instanceof MessagingException)
ex = ((MessagingException) ex).getNextException();
else {
// This is a general catch all and we should assume that no messages went and should stop
System.out.println(ex.toString());
throw ex;
} while (ex != null); -
Problem accessing gmail with IMAP using JavaMail APIs
Hi,
I am trying to access my gmail account with JavaMail API. I am able to access it using pop3s but not with IMAP.
I have used following details:
protocol: imap
host: imap.gmail.com
port: -1 (also tried with 993) but no success.
My basic code is
url = new URLName(protocol, getHostname(), 993, mbox,
getUsername(), getPassword());
Properties props = null;
try {
props = System.getProperties();
} catch (SecurityException sex) {
props = new Properties();
session = Session.getInstance(props, null);
session.setDebug(true);
store = session.getStore(url);
store.connect();
folder = store.getFolder(url);
folder.open(Folder.READ_WRITE);Any pointers?
Thanks.Changed protocol from "imap" to "imaps"....and used port 993...and its working!!!!
-
Getting exceptions while sending mail using javamail api
Hi to all
I am developing an application of sending a mail using JavaMail api. My program is below:
quote:
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
public class sms
public static void main(String args[])
try
String strstrsmtserver="smtp.bol.net.in";
String strto="[email protected]";
String strfrom="[email protected]";
String strsubject="Hello";
String bodytext="This is my first java mail program";
sms s=new sms();
s.send(strstrsmtserver,strto,strfrom,strsubject,bodytext);
catch(Exception e)
System.out.println("usage:java sms"+"strstrsmtpserver tosddress fromaddress subjecttext bodyText");
System.exit(0);
public void send(String strsmtpserver,String strto,String strfrom ,String strsubject,String bodytext)
try
java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
Properties p=new Properties(System.getProperties());
if(strsmtpserver!=null)
p.put("mail.transport.protocol","smtp");
p.put("mail.smtp.host","[email protected]");
p.put("mail.smtp.port","25");
Session session=Session.getDefaultInstance(p);
Message msg=new MimeMessage(session);
Transport trans = session.getTransport("smtp");
trans.connect("smtp.bol.net.in","[email protected]","1234563757");
msg.setFrom(new InternetAddress(strfrom));
msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(strto,false));
msg.setSubject(strsubject);
msg.setText(bodytext);
msg.setHeader("X-Mailer","mtnlmail");
msg.setSentDate(new Date());
Transport.send(msg);
System.out.println("Message sent OK.");
catch(Exception ex)
System.out.println("here is error");
ex.printStackTrace();
It compiles fine but showing exceptions at run time.Please help me to remove these exceptions.I am new to this JavaMail and it is my first program of javamail.Please also tell me how to use smtp server.I am using MTNL 's internet connection having smtp.bol.net.in server.
exceptions are:
Here is exception
quote:
Javax.mail.MessagingException:Could not connect to SMTP host : smtp.bol.net.in, port :25;
Nested exception is :
Java.net.ConnectException:Connection refused: connect
At com.sun.mail.smtp.SMTPTransport.openServer<SMTPTransport.java:1227>
At com.sun.mail.smtp.SMTPTransport.protocolConnect<SMTPTransport.java:322>
At javax.mail.Service .connect(Service.java:236>
At javax.mail.Service.connect<Service.java:137>
At sms.send<sms.java:77>
At sms.main<sms.java:24>Did you find the JavaMail FAQ?
You should talk to your ISP to get the details for connecting to your server.
In this case I suspect your server wants you to make the connection on the
secure port. The FAQ has examples of how to do this for GMail and Yahoo
mail, which work similarly. By changing the host name, these same examples
will likely work for you. -
Question about using JavaMail API to read the calendar folder...
Hi,
I've made an application that goes to the mail server, fetches all mails in the calendar folder and tells you the meetings you have in a particular day.
I'm using JavaMail API for this. My problem is that the application is very slow because I'm forced to fetch (one by one!) the contents of every message.
My question is: How can Outlook show so fast the mettings you have? Do they have a specific API that allows them to get the right info by only calling certain methods? Is there something similar in Java?
Thaks for your help!
Note: I use method:
folder.fetch(allMessages, fetchProfile);howerver the fetchProfile class does not allow me to specfy that I want to dowload the contents of the message (you only can specify the content_info); specifying all headears does not help me either.Clarification:
The VI you have posted will work as following:
1) The task will read 2 analog inputs (ai0, ai3).
2) The acquisition starts, oncece digital signal (trigger) is detected on PFI0
3) The sampling rate will be as specified in "rate" control - it is continuous analog input acquisition, which means that after trigger is received (point 2), the board will start to generate hardware clock with frequency you specify as "rate"
4) with each rising edge of that hardware clock, the measurement is taken, and stored into buffer of driver.
5) DAQmx read will try to read "number of samples per channel" number of samples each time is called - and if there is not enough measurement stored in buffer (step 4), then DAQmx read will wait until DAQ card will measure reaquested number of samples (or timeout occurs before requested number of samples has been acquired)
6) DAQmx read will be then called 1000 times - so totaly you will read 1000 * "number of samples per channel" number of samples.
You do not have to be worried about speed of the loop. In fact, if you need to read just 1000 samples, with 1kS/s, then you can remove for loop and you can change measurement mode from continuous to finite samples, and specify number of samples to read to be 1000. You will read them all properly. I recomend you to read User Manual for your DAQ device - lets say M Series User Manual.
I hope it is clear now.
regards,
stefo -
Third Party APIs in Java Language which doesnot use JavaMail APIs
Hi Pals,
Is there any third party java mail APIs available which doesnot using Sun JavaMail APIs? The third party would have its own APIs which does not use javax.mail. I have to code in Java Platform so if the APIs are java based its nice and useful to me.....
Thanks & Regards,
Prakashksp wrote:
Hi,
I am using Javamail APIs to send mails. Sometimes Mcafee blocks the mails and its not allowing javax.mail package. Thats why i would like to go for some other third pary which uses their own APIs......What makes you think a third party API would be less prone to interference by McAfee?
Edited by: sabre150 on Jun 18, 2009 10:39 AM
:-) -
Is there any way to send email with java without using the javamail api
regards
fightspamTry this
import java.net.*;
import java.util.*;
import java.io.*;
public class email
private static final String host="smtp.smtphost.co.uk";
private static final String to="[email protected]";
private static final String subject="autogenerated message";
static void send(String message)
try
System.getProperties().put("mail.host",host);
URL url = new URL("mailto:" + to);
URLConnection connection = url.openConnection();
connection.setDoInput(false);
connection.setDoOutput(true);
connection.connect();
PrintWriter out = new PrintWriter(new OutputStreamWriter(connection.getOutputStream()));
out.print("From: <"+InetAddress.getLocalHost().getHostName()+">\n");
out.print("To: "+to+"\n");
out.print("Subject: "+subject+"\n");
out.print("\n");
out.print(message);
out.close();
catch (Exception e)
public static void main(String[] args)
for(int i=0;i<10;i++)
send("this is a test message");
} -
JavaMail API(urgent)
Hello
can anyone tell me how can i get the list of emails in the inbox folder using javamail api, any idea exmpleimport java.io.*;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
public class ImapList {
private static java.text.NumberFormat nf0=new
java.text.DecimalFormat("0000");
private static java.text.NumberFormat nf1=new
java.text.DecimalFormat("0000000");
private static String sf00="yyyy/MM/dd hh:mm";
private static String sf01=" ";
private static java.text.DateFormat df0=new
java.text.SimpleDateFormat(sf00);
private static String dumpDate(Date d) {
if (d==null) return sf01;
return df0.format(d);
private String host;
private String user;
private String password;
private static void usage() {
System.err.println("Usage: " + ImapList.class.getName() + " imap_host_name user_name password");
public ImapList(String host_,String user_,String password_)
throws Exception {
host=host_;
user=user_;
password=password_;
public Message[] getList()
throws Exception {
Properties props=new Properties(System.getProperties());
props.put("mail.store.protocol","imap");
Session sess=Session.getDefaultInstance (props,null);
Store store=sess.getStore();
store.connect(host,user,password) ;
Folder folder=store.getDefaultFolder();
Folder f1=folder.getFolder("INBOX");
f1.open(Folder.READ_ONLY);
Message[] ret=f1.getMessages();
//f1.close(false); //WOULD BE AN ERROR TO CLOSE!!
return ret;
public static void main(String argv[]) {
try { main0(argv); }
catch (Exception e) { usage(); e.printStackTrace(); }
private static void main0(String argv[])
throws Exception {
ImapList il=new ImapList(argv[0],argv[1],argv[2]);
Message[] mess=il.getList();
int index=-1;
try {
index=Integer.parseInt(argv[3]);
Message m=mess[index];
new MessageDumper(m).dumpAll();
return;
catch (Exception e) {
// e.printStackTrace();
for(int i=0;i<mess.length;i++) {
Message m=mess[ i ];
Date d0=m.getSentDate();
System.out.print(nf0.format(i) + " " + dumpDate(d0));
Address[] from=m.getFrom();
if (from == null) System.out.print(" NULLFROM");
else for(int j=0;j<from.length;j++) System.out.print(" " + from[j]);
System.out.println("");
System.out.println(sf01+m.getSubject());
} -
JavaMail API on JDK 1.6
After going through README of JavaMail 1.4, i realised that it is not tested on JDK 1.6.
Snippet from README
The JavaMail API supports JDK 1.4 or higher. Note that we have
currently tested this implementation only with JDK 1.4 and 1.5.
I have few queries.
Am i using wrong JavaMail version?
If not then, has anybody tested/usedJavaMail 1.4 with JDK 1.6?
Any issues faced?JDK 1.6 was release long after JavaMail 1.4 was released, which would make
it hard to test JavaMail 1.4 on JDK 1.6. Since the release of JDK 1.6 I've used
JavaMail 1.4 on JDK 1.6 with no problems. Note that the JavaBeans Activation
Framework (JAF, aka activation.jar) is included in JDK 1.6. -
JavaMail API + JMF ins it possible?
Hello all,
how is it possible to send captured and saved video files from within JMF desktop application .I'm not familiar with JavaMail API
so please give some hint to do it..
ThanksYour question doesn't make any sense.
Try asking it again without mentioning "JavaMail" at all. and expand on exactly what it is you're trying to do... -
JavaMail API for enabling email notification
Hi
I want to use JavaMail API for enabling email notification for an application. I have downloaded the javamail_1.4 zip file, unzipped it and set the CLASSPATH environment variable. JAVA_HOME isalso set. the activation.jar file from JAF is also in place. but, when i try to compile the sample programs (included with javamail) like smtpsend.java,msgsend.java, I get a screenful of errors all referring to "cannot find symbol", the main error being
"package javax.mail does not exist". I guess, Java is not able to locate the package.
Please suggest what can be done .Any tips for configuring email notification are more than welcome!
Thanks!Are you compiling using the "javac" command,
or are you using an IDE like Eclipse or NetBeans?
In the latter case, you have to tell the IDE to
add the jar files to your project. -
JavaMail api question..
I'am trying to send an e_mail to myself using the javaMail API.
I have already installed it (and also the Java Activation Framework).
The code is:
import javax.mail.*;
import javax.mail.internet.*;
import java.util.Properties;
import java.util.Date;
import java.io.*;
public class PruebaMail {
public static void main(String[] argv) {
try {
Properties props = new Properties();
Session sendMailSession;
Store store;
Transport transport;
sendMailSession = Session.getInstance(props, null);
props.put("mail.smtp.host", "SMTP.mail.yahoo.com");
Message newMessage = new MimeMessage(sendMailSession);
newMessage.setFrom(new InternetAddress("[email protected]"));
newMessage.setRecipient(Message.RecipientType.TO, new InternetAddress("[email protected]"));
newMessage.setSubject("Prueba 1234");
newMessage.setSentDate(new Date());
newMessage.setText("Le escribimos para informarle que alguien ha respondido a su consulta");
transport = sendMailSession.getTransport("smtp");
transport.send(newMessage);
} catch (MessagingException e1) {
System.out.println("PruebaMail MessagingException:" + e1.getMessage());
.. but, issuing C:\>java PruebaMail .. I get this error:
PruebaMail MessagingException:Sending failed;
nested exception is:
javax.mail.MessagingException: Unknown SMTP host: SMTP.mail.yahoo.com;
nested exception is:
java.net.UnknownHostException: SMTP.mail.yahoo.com
so, my question is:
1. What is wrong in my code. Do you know an available SMTP server which
allows relaying??
thanks in advance!Reverse this order:
sendMailSession = Session.getInstance(props, null);
props.put("mail.smtp.host", "SMTP.mail.yahoo.com");Any property should be set before getting a Session instance.
If your mail server expects authentication you should give one more property, so the code will be:
if(user != null) // should be authenticated
props.put("mail.smtp.auth", "true");
else
props.put("mail.smtp.auth", "false");
props.put("mail.smtp.host", "SMTP.mail.yahoo.com");
sendMailSession = Session.getInstance(props, null);
... // fill newMessage
if(user != null) { // should be authenticated
newMessage.saveChanges();
Transport transport = session.getTransport("smtp");
transport.connect(mailhost, user, password);
transport.sendMessage(newMessage, newMessage.getAllRecipients());
transport.close();
else
Transport.send(newMessage); -
Getting Error while saving a transaction without making any changes to it.
Hi All,
I have a page where in the advance table I add few rows and save the transaction. First time when I save it everything works fine, but when I save it again without making any changes to the fields I get following error:
"Unable to perform transaction on the record. \nCause: The record has been deleted by another user. \nAction: Cancel the transaction and re-query the records to get the new data."
In the same page if I make any changes again it allows me to save the transaction.
Please guide how we can avoid it..
I have already checked many threads related to the issue but nothing has worked. Please help!!
Any help would be highly appreciated..
Regards,
NisheethHi All,
please help!! -
If i made any changes for one employee means it get reflect for others
Dear friends..
I am Abaper, i am in Support phase, i am facing one HR issue. kindly give me some idea to solve.
i have 2 employee number 2025 (VIJAYAN.M) and 2925 (VIJAYAN.M). in this both case employee name is same..
if i made any changes for employee 2025 infotype (for eg bank details) means, 2925 also get reflect the same changes vice versa..
Kindly give me some idea
Regards
DevaHi! Deva,
As you are ABAPer , and if you are doing it through some programing , then you must have getting same problem for all those employees who have similarity in their name or other,
so, please check or debug what criteria you have given for search ,for changing/updating bank key field,
check, it should be perner base not name base or any other.
Please check and revert so that we try to resolve.
Check one thing that is it only problem with bank key any other infotype also.
*Sneha.
Maybe you are looking for
-
Has anyone done any dev work with this software. I'm new to java, and am having problems compiling this... import com.adobe.altercast.sdk.*; import com.adobe.altercast.samples.utils.*; import java.io.*; import java.util.*; import javax.servlet.*; imp
-
Limiting Dimension Values to Dimension Values used on Specfic Day
If I have a dimension with thousands of values. And within my cube, on a given day only a few of those dimension values are actually used. How can I limit the scope of my dimension values to be only the values that exist on that given day?
-
IE browser error message: can't be instantiated
Hi, When I browse my applet in IE, it gives me these error message. Do you have any idea what's going on? I followed the step from the beginning to the end of the help in Jdeveloper2.0. It works fine in development environment. Thanks Hong java.lang.
-
ResultSet.getString() != toString()
We have a method which retrieves values from a result set by simply doing resultSet.getString(index). This works fine in all cases and the result retrieved is as if the proper type is retrieved and a toString() is done on it, except for Timestamps. F
-
Hi, I'm preparing some slides for a presentation. obviously I'm preparing them with Keynote, but I must play them on a pc, with PowerPoint 2007. When I export my key file in ppt ones i have no (evident) problem, but when I try to open file with PP200