Error: javax.mail.SendFailedException

Hi all,
I have a requirement to send a mail on click of a button. I have written a simple java code using java mail API. But while running the application i am getting
javax.mail.SendFailedException: Sending failed;  nested exception is: javax.mail.SendFailedException: Invalid Addresses;  nested exception is: javax.mail.SendFailedException: 550 5.7.1 Unable to relay for [email protected]
If i run the java code as a standalone java application everything is fine. Only in webdynpro application i am getting the above mentioned error.
My question is do we have to configure any settings in the WAS. If so, can somebody give me a detailed answer how to do the configuration.
Thanks and Regards,
Rathna

I stopped the Antivirus service and checked the application but it doesn't help.
Here is the code. But the code is working fine.
// Get system properties
Properties props = new Properties();
// Setup mail server
props.put("mail.pop3.host","myserver");
props.put("mail.pop3.auth","true");
Authentication auth = new Authentication("[email protected]","abcd");
               Session session = Session.getInstance(props,auth);
               Store store = session.getStore("pop3");
               store.connect("myserver","[email protected]","abcd");
               System.out.println("Connected");
               MimeMessage message =  new MimeMessage(session);
               message.setFrom(new InternetAddress("[email protected]"));
               message.addRecipient(javax.mail.Message.RecipientType.TO, new InternetAddress("[email protected]"));
               message.setSubject("Hello JavaMail Attachment");
               // create the message part
               MimeBodyPart messageBodyPart =  new MimeBodyPart();
               //fill message
               messageBodyPart.setText("Hi");
               Multipart multipart = new MimeMultipart();
               multipart.addBodyPart(messageBodyPart);
               // Part two is attachment
               messageBodyPart = new MimeBodyPart();
               String fileAttachment="D:\Message.txt";
               DataSource source =  new FileDataSource(fileAttachment);
               messageBodyPart.setDataHandler(new DataHandler(source));
               messageBodyPart.setFileName(fileAttachment);
               multipart.addBodyPart(messageBodyPart);
               // Put parts in message
               message.setContent(multipart);
                              // Send the message
               javax.mail.Transport.send(message);
               System.out.println("Mail sent successfully");
               store.close();

Similar Messages

  • Javax.mail.SendFailedException: Invalid Addresses

    Hi all,
    I write a web application with a module can send mail to specific mail address using JAVAMAIL . I test my SendMail.java  which has sendEmail() function with command line ../java SendMail and it run OK. But when I call sendEmail() from my web page it throw out ERROR: javax.mail.SendFailedException: Invalid Addresses.
    I don't know why? Do you have any idea about it ?
    Thanks!

    Hi all,
    This is more Error information:
    javax.mail.SendFailedException: Invalid Addresses;
      nested exception is:
        com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
        at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1294)
        at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:635)
        at view.MailImplement.sendEmail(MailImplement.java:152)
        at view.MailImplement.main(MailImplement.java:40)
    Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
    Thanks a lot!

  • Inquiry on javax.mail.SendFailedException: Invalid Addresses error

    Hi,
    Anyone does have any idea why the following is being encountered during the email authentication process? We are using PeopleSoft application and we have notification functionality which will send a notification email to the users but email not being sent due to an invalid email address but actually the email is active and valid. Below are the logs from SMTP
    Log Start:
    DEBUG SMTP: Sending failed because of invalid destination addresses
    Wed Jul 31 09:38:14 GMT+08:00 2013 RSET
    Wed Jul 31 09:38:14 GMT+08:00 2013 250 2.0.0 Resetting
    Wed Jul 31 09:38:20 GMT+08:00 2013 javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
    class com.sun.mail.smtp.SMTPAddressFailedException: 550 5.1.1 User unknown
    Wed Jul 31 09:38:20 GMT+08:00 2013 at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1141)
    Wed Jul 31 09:38:20 GMT+08:00 2013 at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:536)
    Wed Jul 31 09:38:20 GMT+08:00 2013 at com.peoplesoft.pt.mcf.mail.MCFOutboundEmail.send(MCFOutboundEmail.java:686)
    Wed Jul 31 09:38:20 GMT+08:00 2013 at com.peoplesoft.pt.mcf.mail.MCFOutboundEmail.send(MCFOutboundEmail.java:854)
    Log End:
    Kindly let us know your thoughts on this.
    Thanks.

    This isn't an authentication problem.  You're sending to an address that your server doesn't know about, so it's rejecting your message.  The error from the server is:
    550 5.1.1 User unknown

  • Javax.mail.SendFailedException

    HI all,
    I have an application which reads .csv file, picks up email ids and sends e-mail to mentioned 'to' address.
    There are 199 diffreent email ids. I could send upto 90 emails.
    But, after that, i got following error !
    error message:
    javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: Could not connect to SMTP host: mail.**********.com, port: 25
    I don't know the reason for it. Can any one please guide me in this regard?
    Thanks in advance !
    Regards
    Ashvini

    Try to give all the address in TO field with comma seperation and check it out.
    Regards
    Balu

  • Class javax.mail.SendFailedException

    Hi,
    Let me know regarding java mail. I am facing the error as follows,
    ===============Exception=====================
    javax.servlet.ServletException: Sending failed;
    nested exception is:
         class javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
         class javax.mail.SendFailedException: 550 not local host gmail.com, not a gateway
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
         org.apache.jsp.sendmail3_jsp._jspService(sendmail3_jsp.java:75)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    ================sourcecode============================
    <%@ page import="java.util.*, javax.mail.*, javax.mail.internet.*" %>
    <%
    Properties props = new Properties();
    props.put("mail.smtp.host", "66.34.40.98");
    Session s = Session.getInstance(props,null);
    MimeMessage message = new MimeMessage(s);
    InternetAddress from = new InternetAddress("[email protected]");
    message.setFrom(from);
    InternetAddress to = new InternetAddress("[email protected]");
    message.addRecipient(Message.RecipientType.TO, to);
    message.setSubject("Test from JavaMail.");
    message.setText("Hello from JavaMail!");
    Transport.send(message);
    %>
    <html>
    <p align="center">A Message has been sent.<br>Check your inbox.</p>
    <p align="center">Click here to send another!</p>
    </html>

    Is there any rule defined on the mailserver that BPEL is accessing via SMTP? Is it directly checking the address for validation or something?
    Can you do a SMTP transaction on the BPEL server for this mail account only?
    1) Create a notification process that sends a mail only for this user.
    2) open a telnet session from the BPEL server commandline to do a SMTP conference.
    http://nl.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol

  • Javax.mail.SendFailedException: 550 5.7.1 ... Relaying denie

    My machine is on the DNS and does not require authentication to send e-mail. It also can send and recieve e-mail from the outside world with no problems; however this is the error I see in the logs:
    2003-12-11 10:03:49,151 INFO org.dspace.app.webui.servlet.RegisterServlet @ anonymous:session_id=8E5A9C16A74EAA9F334FF566CB6714BF:error_emai$
    javax.mail.SendFailedException: Sending failed;
    nested exception is:
    javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
    javax.mail.SendFailedException: 550 5.7.1 <[email protected]>... Relaying denied
    at javax.mail.Transport.send0(Transport.java:219)
    at javax.mail.Transport.send(Transport.java:81)
    at org.dspace.core.Email.send(Email.java:259)
    at org.dspace.eperson.AccountManager.sendEmail(AccountManager.java:291)
    at org.dspace.eperson.AccountManager.sendInfo(AccountManager.java:251)
    at org.dspace.eperson.AccountManager.sendRegistrationInfo(AccountManager.java:96)
    at org.dspace.app.webui.servlet.RegisterServlet.processEnterEmail(RegisterServlet.java:272)
    at org.dspace.app.webui.servlet.RegisterServlet.doDSPost(RegisterServlet.java:206)
    at org.dspace.app.webui.servlet.DSpaceServlet.processRequest(DSpaceServlet.java:153)
    at org.dspace.app.webui.servlet.DSpaceServlet.doPost(DSpaceServlet.java:110)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    Can someone tell me what I am doing wrong here?
    Thanks.

    The important line in the stack trace is
    javax.mail.SendFailedException: 550 5.7.1 <[email protected]>... Relaying denied
    The 550 error is being returned by the SMTP server to the your client as per the RFC.. It tells us that the client has built a message and has pushed it to the server. The server is looking at the message and finds something it doesn't like. It then returns the 500 series error to the client.
    The relative locations of the server and client may be an issue since you can configure your server to treat clients run locally different, usually you have the localhost unrestricted and put the filters on for everyone else (there are some admins that lock down local clients on the theory that no one should be running a client on the server so if someone tries they must have hacked the box).
    If you try running a different client on the machine with the identical settings for all the header fields you will still get the 550 error. At this point I would have a talk with the admin and ask what the rules for the server are.

  • Please help! javax.mail.SendFailedException is killing me

    im trying to send myself an email through javax.mail and this is the error i get: it is thrown from Transport.send(msg);i dont have access to its source so i cannot trace through it... can anyone please tell me what might cause this error?
    javax.mail.SendFailedException: 550 <[email protected]>: Recipient address rejected: Relay access denied

    Hi,
    I'm trying to send mail thro a servlet.
    When I use host as 'mail.vsnl.com'
    It gives the following exeception
    Relay access denied
    can U help me!
    thanks in adv.
    Isaaac

  • [help] javax.mail.SendFailedException

    What it means?
    javax.mail.SendFailedException: Invalid Addresses; nested exception is: class com.sun.mail.smtp.SMTPAddressFailedException: 553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)
    I use javax.mail API to send email from java servlet using a .info smtp server.
    It is the domain .info that create this error?
    Can i resolve?
    I tryed with a .it smtp server but it doesn't change...only with the server smtp of my ISP the mail was send correctly!
    Sorry for my english...Help Me!

    The SMTP server you use does not allow relaying mesages from/to the specified domain. Example: you cannot use yahoo's SMTP server to relay an email to [email protected] Change your rcpthosts on the SMTP server.

  • Javax.mail.SendFailedException: 550 5.7.1

    While trying to insert technician details into the DB, I get the following error. In the details I am entering an email id to which an email should be sent describing the details. The error is below :
    Error:  Error while Inserting Technician Details.Sending failed; nested exception is: javax.mail.SendFailedException: Invalid Addresses; nested exception is: javax.mail.SendFailedException: 550 5.7.1 Unable to relay for [email protected]
    Could anyone please suggest a solution ?.
    Your answers would be rewarded!!
    Thanks,
    Padmarajan

    Hi Padmarajan,
    Can you try this first from your Portal server ...
    telnet smtpserverip 25
    if you can connect then try sending a dummy mail to the same id as mentioned below.
    This will help to verify if the problem exists at Portal level or SMTP server
    regards,
    piyush
    ps: please mark all useful answers.
    regards,
    piyush

  • Javax.mail.SendFailedException: 550 5.7.1 Unable to relay

    Hi All,
    I am getting the below Exception message when I am executing my JavaMail
    program.
    nested exception is:
         javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
         javax.mail.SendFailedException: 550 5.7.1 Unable to relay for [email protected]
    Please can anyone help me out.
    Regards,
    Ravi.

    what's wrong to this source code, if try to send mail to local account actually it success, but if i try to send mail eg:[email protected](outside my network) i found error this error to. i had to try not use encode userID/password into base64, but the result doesn't change.
    if anyone have solution for this problem, please contact me @ [email protected]
    Regards,
    agam
    error returned by java:
    javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
    class javax.mail.SendFailedException: 550 Relaying is prohibited
    void com.sun.mail.smtp.SMTPTransport.sendMessage(javax.mail.Message, javax.mail.Address[])
    import java.util.*;
    import java.io.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    import com.sun.mail.smtp.SMTPTransport;
    import com.agam198.util.*;
    public class PCMMail{
    String sMailServer = "";
    String sUserID = "";
    String sPassword = "";
    int iPort = 25;
    String sTo = "";
    String sFrom = "";
    String sCC = "";
    Message msg = null;
    SMTPTransport transport = null;
    Transport trns = null;
    public PCMMail(StringPool sPool){
    this.sMailServer = sPool.getString("SMTPServer.SERVER");
    this.sTo = sPool.getString("SMTPAlert.TO");
    this.sFrom = sPool.getString("SMTPAlert.FROM");
    this.sCC = sPool.getString("SMTPAlert.CC");
    this.sUserID = sPool.getString("SMTPServer.LOGIN");
    this.sPassword = sPool.getString("SMTPServer.PASSWORD");
    this.iPort = Integer.parseInt(sPool.getString("SMTPServer.PORT"));
    initConnection();
    public void initConnection(){
    try{
    System.out.println("MailServer: "+sMailServer);
    System.out.println("To: "+sTo);
    System.out.println("From: "+sFrom);
    System.out.println("CC: "+sCC);
    Properties props = new Properties();
    props.put("mail.smtp.host", "152.118.89.0");
    Session session = Session.getDefaultInstance(props,null);
    trns = session.getTransport("smtp");
    if(trns == null){
    System.out.println("trans is not null");
    else
    System.out.println("trans null");
    trns.connect(sMailServer,Base64.base64Encode ( sUserID ),Base64.base64Encode ( sPassword ));
    if(trns.isConnected()){
    System.out.println("connected to SMTP SERVER");
    else{
    System.out.println("not connect");
    InternetAddress address = new InternetAddress();
    //create a message
    msg = new MimeMessage(session);
    catch(Exception e){
    public void sendMessage(String message){
    sendMessage(getFirstLine(message),message);
    public void sendMessage(String subject,String message){
    try{
    //prepare message
    msg.setFrom(new InternetAddress(sFrom));
    msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(sTo));
    msg.setSubject(subject);
    msg.setSentDate(new Date());
    msg.setText(message);
    trns.send(msg);
    System.out.println("message sent");
    catch(Exception e){
    e.printStackTrace();
    public String getFirstLine(String message){
    BufferedReader buf = new BufferedReader(new StringReader(message));
    try{
    return buf.readLine();
    catch(Exception e){
    return " ";
    public static void main(String[] args){
    StringPool sp = new StringPool();
    sp.set("SMTPServer.SERVER","152.118.89.0");
    sp.set("SMTPServer.PORT","25");
    sp.set("SMTPServer.LOGIN","kiara");
    sp.set("SMTPServer.PASSWORD","kiara");
    sp.set("SMTPAlert.TO","[email protected]");
    sp.set("SMTPAlert.FROM","[email protected]");
    sp.set("SMTPAlert.CC","");
    PCMMail pcm = new PCMMail(sp);
    pcm.sendMessage("subject","message body");
    }

  • Invalid Addresses; nested exception is: class javax.mail.SendFailedException: 550 5.7.1 Unable to relay for

    Hi!
    I am with a problem during a sending e-mail for 3500
    addressees.
    In the way it process me of the one error and in log CF
    Administrator shows the following error to it:
    Invalid Addresses; nested exception is: class
    javax.mail.SendFailedException: 550 5.7.1 Unable to relay for
    What it could be?
    Server Configuration:
    Windows 2003 Standard with ColdFusion MX 7.02 (last update)
    Best Regards

    You need to either authenticate your user or turn on relaying in your SMTP server. See the JavaMail tutorial for how to authenticate

  • Error: "javax.mail.MessagingException: 505 5.7.3 Client not Authenticated

    While trying to run a program to sent sms to mobile(with airtel connection)it shows the Error:
    "javax.mail.MessagingException: 505 5.7.3 Client was not Authenticated.
    If anyone knows how to resolve this problem please reply.
    The Code is as follows:
    import java.io.*;
    import java.net.InetAddress;
    import java.util.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    public class EmailSMS
    String TO;
    String FROM;
    String SUBJECT,TEXT,MAILHOST,LASTERROR;
    public static void main(String [] args) throws Exception
         EmailSMS SMS=new EmailSMS();
         SMS.setMailHost("kcsl.com");
         SMS.setTo("[email protected]");
         SMS.setFrom("[email protected]");
         SMS.setSubject("");
         SMS.setText("Hello World");
         boolean ret = SMS.send();
         if(ret){
              System.out.println("SMS was sent");
         else
              System.out.println("SMS was not sent"+SMS.getLastError());
    public EmailSMS()
         TO=null;
         FROM=null;
         SUBJECT=null;
         TEXT=null;
         LASTERROR="No methods calls";
    public void setTo(String to){TO=to;}
    public String getTo(){return TO;}
    public void setFrom (String from){FROM=from;}
    public String getFrom(){ return FROM;}
    public void setSubject(String subject){SUBJECT=subject;}
    public String getSubject(){return SUBJECT;}
    public void setText(String text){TEXT=text;}
    public void setMailHost(String host){MAILHOST=host;}
    public String getMailHost(){return MAILHOST;}
    public String getLastError(){return LASTERROR;}
    public boolean send()
         int maxLength;
         int msgLength;
         //Check to make sure that the parameters are correct
         if(TO.indexOf("mobile.att.net")>0)
              maxLength=140;
         else if(TO.indexOf("messaging.nextel.com")>0)
         {maxLength=280;}
         else if(TO.indexOf("messaging.sprintpcs.com")>0)
         {maxLength=100;}
         else maxLength=160;
         msgLength=FROM.length()+1+SUBJECT.length()+1+TEXT.length();
         if(msgLength>maxLength)
              LASTERROR="SMS length too long";
              return false;
         //set email properties
         Properties props=System.getProperties();
         if(MAILHOST!=null){props.put("mail.smtp.host",MAILHOST);}
         Session session=Session.getDefaultInstance(props,null);
         try{
              Message msg=new MimeMessage(session);
              if(FROM!=null){msg.setFrom(new InternetAddress(FROM));}
              else{msg.setFrom();}
              msg.setSubject(SUBJECT);
              msg.setText(TEXT);
              msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(TO,false));
              msg.setSentDate(new Date());
              Transport.send(msg);
              LASTERROR="Success";
              return true;
         catch(MessagingException max ){LASTERROR=max.getMessage();
         return false;}
    thanku

    Hi,
    it seems to me that you must authenticate with your smtp host. In order to do so, try following:
    While trying to run a program to sent sms to
    mobile(with airtel connection)it shows the Error:
    "javax.mail.MessagingException: 505 5.7.3 Client was
    not Authenticated.
    If anyone knows how to resolve this problem please
    reply.
    The Code is as follows:
    import java.io.*;
    import java.net.InetAddress;
    import java.util.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    public class EmailSMS
    String TO;
    String FROM;
    String SUBJECT,TEXT,MAILHOST,LASTERROR;
    public static void main(String [] args) throws
    Exception
         EmailSMS SMS=new EmailSMS();
         SMS.setMailHost("kcsl.com");
         SMS.setTo("[email protected]");
         SMS.setFrom("[email protected]");
         SMS.setSubject("");
         SMS.setText("Hello World");
         boolean ret = SMS.send();
         if(ret){
              System.out.println("SMS was sent");
         else
    System.out.println("SMS was not
    t sent"+SMS.getLastError());
    public EmailSMS()
         TO=null;
         FROM=null;
         SUBJECT=null;
         TEXT=null;
         LASTERROR="No methods calls";
    public void setTo(String to){TO=to;}
    public String getTo(){return TO;}
    public void setFrom (String from){FROM=from;}
    public String getFrom(){ return FROM;}
    public void setSubject(String
    subject){SUBJECT=subject;}
    public String getSubject(){return SUBJECT;}
    public void setText(String text){TEXT=text;}
    public void setMailHost(String host){MAILHOST=host;}
    public String getMailHost(){return MAILHOST;}
    public String getLastError(){return LASTERROR;}
    public boolean send()
         int maxLength;
         int msgLength;
         //Check to make sure that the parameters are correct
         if(TO.indexOf("mobile.att.net")>0)
              maxLength=140;
         else if(TO.indexOf("messaging.nextel.com")>0)
         {maxLength=280;}
         else if(TO.indexOf("messaging.sprintpcs.com")>0)
         {maxLength=100;}
         else maxLength=160;
         msgLength=FROM.length()+1+SUBJECT.length()+1+TEXT.leng
    h();
         if(msgLength>maxLength)
              LASTERROR="SMS length too long";
              return false;
         //set email properties
         Properties props=System.getProperties();
         if(MAILHOST!=null){props.put("mail.smtp.host",MAILHOST
    Session
    session=Session.getDefaultInstance(props,null);
         try{     // Get a Transport object to send e-mail
                   Transport bus = session.getTransport("smtp");
                   // Connect only once here
                   // Transport.send() disconnects after each send
                   bus.connect(host, username, password);
              Message msg=new MimeMessage(session);
    if(FROM!=null){msg.setFrom(new
    w InternetAddress(FROM));}
              else{msg.setFrom();}
              msg.setSubject(SUBJECT);
              msg.setText(TEXT);
              msg.setRecipients(Message.RecipientType.TO,InternetAd
    ress.parse(TO,false));
              msg.setSentDate(new Date());// Send message
              bus.send(msg);
              bus.close();
              LASTERROR="Success";
              return true;
    catch(MessagingException max
    ){LASTERROR=max.getMessage();
         return false;}
    thankuGood luck

  • Error javax.mail.NoSuchProviderException: pop3

    When my application runs within JBuilder everything works fine. But with a native executable I get the following error: javax.mail.NoSuchProviderException: pop3.
    The Dependencies property for JavaMail=Include Dependencies. When set to Include All the native executable not even starts.
    What is wrong here?
    Greetings,
    Hans

    I had some difficulty looking for a solution to this problem.
    All solutions 'beat about the same bush' but I couldnt get any of them to work.
    My advice is dont give up- the problem will eventually be resolved.
    How I resolved it was to assume, ( rightly) that when working inside JBuilder, it is not using the machine classpath to find library files such as mail.jar, but looking at its own library of jar files to find mail.jar.
    I tracked down the JBuilder mail.jar in the /lib dir and copied out all classes beginning with POP... also all non Class files eg proviider and map files , the mailcap file and all files beginning with SUN, and also the Manifest file and placed them in a separate folder on the hard drive.
    I then made an application jar definition from my JBuilder application but told it NOT to make a manifest file.I then right clicked on the build file, and selected properties/content and added in all files from the directory that I previously made containing the files mentioned above.
    To the Manifest file in that directory I also added the mine Main Class: to tell it where my main class was.
    I then re-built the executable jar file.
    It worked. Just when I was down to pulling out the last tuft of hair.
    Message was edited by:
    1straybullet

  • Javax.mail.SendFailedException: Recipient unknown

    Hi,
    I know similar topics have been posted before but even after going through them all I have still not found a solution.
    I am trying to send alert emails through my JavaMail application and get the Exception below. I am able to send emails to internal address', but not external address' such as my hotmail account. I have even asked the Administrator to put my IP address in the list of allowed IP's. Does anyone have any ideas? If anyone would like to take a look at the source code i have pasted it underneath the stacktrace.
    Thanks in advance.
    javax.mail.SendFailedException: Sending failed;
    nested exception is:
    javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
    javax.mail.SendFailedException: 550 <[email protected]>, Recipient unknown
    javax.mail.SendFailedException: Sending failed;
    nested exception is:
    javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
    javax.mail.SendFailedException: 550 <[email protected]>, Recipient unknown
    at javax.mail.Transport.send0(Transport.java:218)
    at javax.mail.Transport.send(Transport.java:80)
    at Test1.main(Test1.java:28)
    SOURCE:
    import javax.mail.internet.*;
    import javax.activation.*;
    final public class Test1 {
    private static Session session;
    public static void main(String[] args)
         try
              Properties props = new Properties();
              props.put ("mail.smtp.host", "207.132.45.5");
              props.put ("mail.smtp.port", "25");
              session = Session.getInstance(props, null);
              MimeMessage message = new MimeMessage(session);
              message.setFrom (new InternetAddress ("[email protected]"));
              message.setRecipient (Message.RecipientType.TO, new InternetAddress ("[email protected]"));
              message.setSubject ("test message");
              Multipart multipart = new MimeMultipart();
              BodyPart messageBodyPart = new MimeBodyPart();
              multipart.addBodyPart (messageBodyPart);
              messageBodyPart.setText ("message body");
              message.setContent (multipart);
              javax.mail.Transport.send (message);
         } catch (Exception e) {
              System.out.println (e.toString());
              e.printStackTrace();

    Personal, I am sending a class example that uses authentication in the email sending:
    * Class JAVA
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    import java.lang.*;
    import java.lang.Exception;
    public class email
    public void sendSimpleMail (String mailServer, String subject,String to,String from, String mensagem)
    throws AddressException , MessagingException
    Properties mailProps = System.getProperties();
    mailProps.put("mail.smtp.host", mailServer);
    mailProps.put("port","25");
    mailProps.put("mail.smtp.auth", "true");
    Session mailSession = Session.getDefaultInstance(mailProps, new MyPasswordAuthenticator("username", "password"));
    InternetAddress destinatario = new InternetAddress (to);
    InternetAddress remetente = new InternetAddress (from);
    Message message = new MimeMessage (mailSession);
    message.setFrom(remetente);
    message.setRecipient( Message.RecipientType.TO, destinatario );
    message.setSubject (subject);
    message.setContent (mensagem.toString(), "text/plain");
    try
    Transport transport = mailSession.getTransport("smtp");
    transport.connect(mailServer," ", " ");
    transport.send(message);
    catch (javax.mail.SendFailedException sfe)
    System.out.println("FALHA: " + sfe);
    catch (MessagingException e)
    System.out.println("erro: " + e);
    /** This is the authenticator for SMTP session */
    public static class MyPasswordAuthenticator extends Authenticator
    private String username = null;
    private String password = null;
    public MyPasswordAuthenticator(String username, String password)
    super();
    this.username = username;
    this.password = password;
    public PasswordAuthentication getPasswordAuthentication()
    return new PasswordAuthentication(username, password);
    * File JSP
    <html>
    <body>
    <%@ page import="email, javax.mail.*, javax.mail.internet.*, java.util.*" %>
    <jsp:useBean id="email" scope="session" class="email"/>
    <%
    try
    String mailServer = "myServer";
    String assunto = request.getParameter("assunto");
    String para = request.getParameter("para");
    String de = request.getParameter("de");
    String mensagem =request.getParameter("mensagem");
    email.sendSimpleMail(mailServer, assunto, para, de, mensagem);
    %>
    <p>Email enviado com Sucesso !!!</p>
    <%
    catch (AddressException e)
    %> <p>Endereco de Email invalido</p><%
    catch (MessagingException e)
    %> <p>Impossivel enviar o email.</p><%
    %>
    </body>
    </html>

  • Send mail through Java program. ERROR javax.mail.MessagingException: [EOF]

    Hi,
    i've a java Mail program which will send the mail thro smtp server.
    when i try to execute this program im getting the error javax.mail.MessagingException: [EOF]
    i've attached both code & error.
    while running the program need to give the arguments
    ex : java SendMail smtpserver frommailid tomailid subject body
    please provide me the solution.
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    public class SendMail {
         public static void main(String[] args) {
              try
         String smtpServer=args[0];
         String to=args[1];
         String from=args[2];
         String subject=args[3];
         String body=args[4];
         send(smtpServer, to, from, subject, body);
         catch (Exception ex)
         System.out.println("Usage: java SendMail"
         +" smtpServer toAddress fromAddress subjectText bodyText");
         System.exit(0);
         public static void send(String smtpServer, String to, String from
                   , String subject, String body)
                   try
                   Properties props = System.getProperties();
                   props.put("mail.smtp.host", smtpServer);
                   Session session = Session.getDefaultInstance(props, null);
                   Message msg = new MimeMessage(session);
                   msg.setFrom(new InternetAddress(from));
                   msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(to, false));
                   msg.setSubject(subject);
                   msg.setText(body);
                   msg.setSentDate(new Date());
                   System.out.println("test 1--");
                   Transport.send(msg);
                   System.out.println("test 2--");
                   System.out.println("Message sent OK.");
                   catch (Exception ex)
                   ex.printStackTrace();
    thanks for the help in advance.
    regs
    lal.

    I ran into a similar error today. I fixed it by setting up SMTP authentication because my ISP's help pages said that they would allow only SMTP authentication.
    Here is what I did:
    Transport transport =
    mailConnection.getTransport("smtp");
    transport.connect(
    "hostname", "email", "password");
    Transport.send(msg);
    I also passed the following property while creating the session:
    props.put("mail.smtp.auth", "true");
    finally turning on debug helped:
    session.setDebug(true);
    session.setDebugOut(null);
    Hope this helps

Maybe you are looking for

  • Archive and delete sap event management objects

    Team, I need to configure the archiving objects and residence time to Archive and delete EM objects. there are three steps of configuration, and I have never done this before. Can any one of you help me in setting up this config and the programs that

  • Where is the WAP Settings in Nokia 6230i

    I need help finding WAP settings for my Nokia 6230i!! PLEASE Someone help me. I really need them. It's urgent.

  • How to remove the colors of tab?

    In fact,I was confused with that I couldn't catch which tab was actived in Firefox14.0.1 . How can I close the tab I'd browsed? The tabs were colorful ,but I wish a uncomplicated view.

  • Illustrator crashes when opening Flash-exported SVG

    Illustrator (latest CC version) always crashes when I try to open a Flash-exported SVG. It doesn't matter if I try to open it directly or import to a blank document. Other SVGs open well. I've already disabled all non-essential Windows 7 services. Do

  • RSR_OLAP_BADI question

    Hi, I am using this BADI to calculate the virtual KF for my query. In the calculation of the query, the attributes which come to the COMPUTE are repetitive, and the same calculation happens again and again. So, I want to create a global internal tabl