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

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!

  • 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();

  • 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.

  • [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");
    }

  • 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>

  • 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

  • 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

  • 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

  • Attempt to access invalid address error message

    What does this mean "Attempt to access invalid address" Happens when I try to open PS element 5. I uninstalled and reinstalled my PS element 5 but error message still appears when I try to open the PS sw.

    Hi Garry,
    Yes, I did download PSE 8 and it did work.  However, the trial period has ended.  I have uninstalled PSE 8.  I have also unistalled PSE 5 and then reloaded it.  Upon completeion of the PSE 5 load, I tried to open the PSE 5 and the invalid address error message continues to display.  I am very sad that I cant get PSE 5 to work.  Can you help with more things I can try?  Please let me know
    All the best
    David

  • Exception in thread "main" javax.mail.NoSuchProviderException: invalid prov

    HI,
    I am trying to read mails from my inbox i amgetting the ErrorC:\javamail>java
    Readmail
    Exception in thread "main" javax.mail.NoSuchProviderException: No provider for IMAP
            at javax.mail.Session.getProvider(Session.java:455)
            at javax.mail.Session.getStore(Session.java:530)
            at javax.mail.Session.getStore(Session.java:510)
            at Readmail.main(Readmail.java:24)My Code is    {
    String host = "hostname";
    String username = "user";
    String password = "password";
    // Create empty properties
    Properties props = new Properties();
    // Get session
    Session session = Session.getDefaultInstance(props,null);
    // Get the store
    Store store = session.getStore("IMAP");
    store.connect(host, username, password);
    // Get folder
    Folder folder = store.getFolder("Inbox");
    folder.open(Folder.READ_ONLY);
    // Get directory
    Message message[] = folder.getMessages();
    for (int i=0, n=message.length; i<n; i++)
       System.out.println(i + ": " + message.getFrom()[0]
    + "\t" + message[i].getSubject());
    // Close connection
    folder.close(false);
    store.close();
    I have also tried POP3 and MIME and SMTP
    Can anyone help me Thanks

    hi bshannon,
    I am getting the same error for others but for pop3 the error is as below
    Exception in thread "main" javax.mail.MessagingException: Connect failed;
      nested exception is:
            java.net.ConnectException: Connection refused: connect
            at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:148)
            at javax.mail.Service.connect(Service.java:275)
            at javax.mail.Service.connect(Service.java:156)
            at Readmail.main(Readmail.java:25)
    Caused by: java.net.ConnectException: Connection refused: connect
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
            at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
            at java.net.Socket.connect(Socket.java:452)
            at java.net.Socket.connect(Socket.java:402)
            at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:232)
            at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
            at com.sun.mail.pop3.Protocol.<init>(Protocol.java:81)
            at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:201)
            at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:144)
            ... 3 more

  • Sending mail to invalid addresses

    Hello
    I'm using TransportListener to catch TransportEvent, and my gmail account
    My problem is that when i send a message to an invalid address, the event caught is MessageDelivered, ie, the mail is ever sent successfully, even when it is invalid, and i can't get unknown addresses.
    message.addRecipient(Message.RecipientType.TO,
      new InternetAddress("*[email protected]*")); // <- invalid address
    message.setSubject("Hello");
    message.setText("message");
    Transport t = session.getTransport("smtp");
    t.addTransportListener(listener);
    t.addConnectionListener(listener);
    t.connect("[email protected]", "****");
    t.sendMessage(message, message.getAllRecipients());what can i do?

    [http://java.sun.com/products/javamail/FAQ.html#badaddr|http://java.sun.com/products/javamail/FAQ.html#badaddr]
    Apparently Gmail doesn't verify the address before accepting the message.

Maybe you are looking for