Javamail using Gmail SMTP 465 port!

I am trying to send mail using JAVAMAIL API with GMAIL SMTP on port 465.
Now, I setup my outlook smtp.gmail.com with port 465 and I was able to send e-mail using outlook. So, I am sure it can be done using javamail as well. However, when I tried the same with javamail, I keep getting the following authentication error: Coud someone please let mne know how to get rid of this error and make my code work?I appreciate your help.
Thanks,
Venkat
Error:
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Su
n Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL false
220 mx.gmail.com ESMTP i20sm2352180wxd
DEBUG SMTP: connected to host "smtp.gmail.com", port: 465
EHLO vkat
250-mx.gmail.com at your service
250-SIZE 20971520
250-8BITMIME
250-AUTH LOGIN PLAIN
250 ENHANCEDSTATUSCODES
DEBUG SMTP: Found extension "SIZE", arg "20971520"
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "AUTH", arg "LOGIN PLAIN"
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: use8bit false
MAIL FROM:<[email protected]>
530 5.7.0 Authentication Required i20sm2352180wxd
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Authentication Required i20sm2352180wxd
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1333)
Following is the snippet of my code:
Properties p = new Properties();
p.put("mail.smtp.user", "[email protected]");
     p.put("mail.smtp.host", mailhost);
     p.put("mail.smtp.port", "465");
     p.put("mail.smtp.starttls.enable","true");
     p.put( "mail.smtp.auth ", "true ");
     p.put("mail.smtp.debug", "true");
     p.put("mail.smtp.socketFactory.port", "465");
p.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
p.put("mail.smtp.socketFactory.fallback", "false");
     SecurityManager security = System.getSecurityManager();
System.out.println("Security Manager" + security);
try {
     Authenticator auth = new SMTPAuthenticator();
          Session session = Session.getInstance(p, auth);
          session.setDebug(true);
     //session = Session.getDefaultInstance(p);
          MimeMessage msg = new MimeMessage(session);
          msg.setText(text);
          msg.setSubject(subject);
          Address fromAddr = new InternetAddress("[email protected]");
          msg.setFrom(fromAddr);
          Address toAddr = new InternetAddress(_to);
          msg.addRecipient(Message.RecipientType.TO, toAddr);
          System.out.println("Message: " + msg.getContent());
          Transport.send(msg);
catch (Exception mex) {            // Prints all nested (chained) exceptions as well
System.out.println("I am here??? ");
          mex.printStackTrace();
private class SMTPAuthenticator extends javax.mail.Authenticator {
          public PasswordAuthentication getPasswordAuthentication() {
               return new PasswordAuthentication("[email protected]", "xxxxxxxxxxx"); // password not displayed here, but gave the right password in my actual code.
     }

Hi!
I tried the following code:
String mailhost = "smtp.gmail.com";
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
Properties props = new Properties();
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", mailhost);
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class",
"javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
props.setProperty("mail.smtp.quitwait", "false");
Session session = Session.getDefaultInstance(props, new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("username", "password");
MimeMessage message = new MimeMessage(session);
message.setSender(new InternetAddress(from));
message.setSubject("test");
message.setContent("hello!", "text/plain");
InternetAddress[] addressTo = new InternetAddress[recipients.length];
for (int i = 0; i < recipients.length; i++)
addressTo[i] = new InternetAddress(recipients);
message.setRecipients(Message.RecipientType.TO, addressTo);
Transport.send(message);
} catch (AddressException ex) {
ex.printStackTrace();
out.print(ex);
} catch (MessagingException ex) {
ex.printStackTrace();
out.print(ex);
}catch(Exception ex){
out.print(ex);
But I get following error:
javax.mail.AuthenticationFailedException: 535-5.7.1 Username and Password not accepted. Learn more at 535 5.7.1 http://mail.google.com/support/bin/answer.py?answer=14257 b12sm2275215rvn.22
Kindly let me know the code to send mails using Gmail SMTP server through JavaMail. I am using Win XP.
The JavaMail code which was working in Win 7 is:
try {          
String username=null;
String password=null;
boolean debug = true;
//Set the host smtp address
Properties props = new Properties();
//props.put("mail.smtp.host", "smtp.live.com");
String host="smtp.gmail.com";
props.put("mail.smtp.auth", "true");
//props.put("mail.smtp.port","587");
// props.put("mail.smtp.port","465");
//props.put("mail.smtp.port","995");
//props.put("mail.smtp.port","8084");
// Authenticator a1= new PopupAuthenticator();
// create some properties and get the default Session
Session session1 = Session.getDefaultInstance(props, null);
session1.setDebug(debug);
// create a message
Message msg = new MimeMessage(session1);
// set the from and to address
//InternetAddress addressFrom = new InternetAddress(from);
//msg.setFrom(addressFrom);
InternetAddress[] addressTo = new InternetAddress[recipients.length];
for (int i = 0; i < recipients.length; i++)
addressTo[i] = new InternetAddress(recipients[i]);
msg.setRecipients(Message.RecipientType.TO, addressTo);
// Setting the Subject and Content Type
msg.setSubject("test");
msg.setContent("hello!", "text/plain");
//msg.setText(message);
//Transport.send(msg);
username = from;
password = pwd;
Transport t = session1.getTransport("smtps");
try {
t.connect(host, username, password);
//t.connect(host, username);
msg.saveChanges();
t.sendMessage(msg, msg.getAllRecipients());
catch (Exception ex) {
//ex.printStackTrace();
out.println(ex);
finally {
t.close();
} catch (Exception ex) {
ex.printStackTrace();
out.println(ex);
/* Email Sent*/
Unfortunately this code does not work in Win XP. Following exception is generated in Win XP:
javax.mail.MessagingException: can't determine local email address
It wuld be great if somebody could help me out with this issue in Win XP asap.

Similar Messages

  • Thunderbird fails to gmail smtp - ssl_error_inappropriate_fallback_alert

    I've a new install on an a work XP machine. The same install version on a home XP machine does not have the same problem with the same gmail accounts.
    On the work machine with a clean install of 31.3.0 thunderbird, I cannot use gmail smtp services. Other smtp services to yahoo and my own domain work properly.
    The error log;
    Timestamp: 1/7/2015 8:01:35 AM
    Error: An error occurred during a connection to smtp.googlemail.com:465.
    The server rejected the handshake because the client downgraded to a lower TLS version than the server supports.
    (Error code: ssl_error_inappropriate_fallback_alert)
    Following the guide for a firefox issue I followed the recommendation to modify the "security.tls.version.min"
    https://support.mozilla.org/en-US/questions/1038836
    For values 0 and 1, the same error log appears. For values 2 and 3 no error log is written to the error console yet sending mail still fails with;
    Sending of message failed.
    The message could not be sent using SMTP server smtp.googlemail.com for an unknown reason. Please verify that your SMTP server settings are correct and try again, or contact your network administrator
    Any thoughts?

    On the same work machine I can add the gmail account into MS Outlook, sending to googlemail.com:465 or gmail.com:465 work properly.
    Also tried switching Thunderbird to use ports 587 and 25. When using either of these ports thunderbird takes a minute, then fails to connect to the remote server. Error log get this written;
    Timestamp: 1/7/2015 8:34:31 AM
    Error: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIMsgMailNewsUrl.server]" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame :: resource:///modules/activity/alertHook.js :: alertHook.onAlert :: line 48" data: no]
    Source File: resource:///modules/activity/alertHook.js
    Line: 48
    I can't be certain if it is a corporate firewall issue or not. They may pinhole the ports when used by Outlook but block them from other apps.

  • Thunderbird failts to gmail smtp - ssl_error_inappropriate_fallback_alert

    I've a new install on an a work XP machine. The same install version on a home XP machine does not have the same problem with the same gmail accounts.
    On the work machine with a clean install of 31.3.0 thunderbird, I cannot use gmail smtp services. Other smtp services to yahoo and my own domain work properly.
    The error log;
    Timestamp: 1/7/2015 8:01:35 AM
    Error: An error occurred during a connection to smtp.googlemail.com:465.
    The server rejected the handshake because the client downgraded to a lower TLS version than the server supports.
    (Error code: ssl_error_inappropriate_fallback_alert)
    Following the guide for a firefox issue I followed the recommendation to modify the "security.tls.version.min"
    https://support.mozilla.org/en-US/questions/1038836
    For values 0 and 1, the same error log appears. For values 2 and 3 no error log is written to the error console yet sending mail still fails with;
    Sending of message failed.
    The message could not be sent using SMTP server smtp.googlemail.com for an unknown reason. Please verify that your SMTP server settings are correct and try again, or contact your network administrator
    Any thoughts?

    Sorry, duplicate post of https://support.mozilla.org/en-US/questions/1040152
    Please delete.

  • How to use gmail with JavaMail

    JavaMail 1.4 is capable of sending and reading messages using gmail.
    All that's required is to properly configure JavaMail. I'll
    illustrate the proper configuration using the demo programs that
    come with JavaMail - msgshow.java and smtpsend.java.
    Let's assume your gmail username is "[email protected]" and your
    password is "passwd".
    To read mail from your gmail Inbox, invoke msgshow as follows:
    java msgshow -D -T pop3s -H pop.gmail.com -U user -P passwdBy reading the msgshow.java source code, you can see how these
    command line arguments are used in the JavaMail API. You should
    first try using msgshow as shown above, and once that's working
    move on to writing and configuring your own program to use gmail.
    To send a message through gmail, invoke smtpsend as follows:
    java -Dmail.smtp.port=587 -Dmail.smtp.starttls.enable=true smtpsend
            -d -M smtp.gmail.com -U user -P passwd -A [email protected](Note that I split the command over two lines for display, but you
    should type it on one line.)
    The smtpsend command will prompt for a subject and message body text.
    End the message body with ^D on UNIX or ^Z on Windows.
    Gmail requires the use of the STARTTLS command, and requires a
    non-standard port, which the smtpsend program doesn't have command
    line options to select so we set them as System properties on the
    java command. The smtpsend.java program uses the System properties
    when creating the JavaMail Session, so the properties set on the
    command line will be available to the JavaMail Session.
    Again, you can read the smtpsend.java source code to see how the
    command line arguments are used in the JavaMail API. There is,
    of course, more than one way to use the JavaMail API to accomplish
    the same goal. This should help you understand the essential
    configuration parameters necessary to use gmail.
    And no, I won't send you an invitation to gmail. Sorry.

    I notice that it's possible to have sticky posts in these forums. See
    http://forum.java.sun.com/forum.jspa?forumID=534
    the Concurrency forum for an example. Posting a link to the FAQ in a sticky post might reduce the number of FAQs asked here by maybe 1%? Or posts like this one might do well as a sticky?

  • Scan to email using gmail as SMTP

    I have an HP Office Jet Pro 8600 N911g printer.  I have this currently setup with the scan to network folder working great.  I would like to set the scan to email.  As the corporate office uses exchange I have to use another service for SMTP.  I setup a Gmail account and puched in the appropriate settings, but the unit fails to connect to gmail.  I've tried multiple ports without success, I've also tried setting up the email server settings, again trying multiple ports without success.  I've tried using every combination using SSL and SMTP authentication, but nothing seems to connect.
    Does gmail actually work, I've seen some say yes, others say no.  Is there another service that would work outside my corporate network or do I need to setup an internal email server, just so I can scan to emails?
    This question was solved.
    View Solution.

    Hi,
    Try following the exact steps below and check if that may help:
    Click the network setting on the printer and locate its IP Address.
    Type that IP  from the browser on your PC to access its EWS page.
    Click the Scan tab.
    Under Scan to E-mail click Outgoing Email Profiles.
    Click New.
    Type your email address and any selected Display name, then click Next.
    Note: be sure to take a note of the specific Display Name.
    Fill the mail settings as following:
    - smtp.gmail.com
    - 465
    - Check the box next to SSL
    - Check the box next to the SMTP Authentication option
    - Type your full gmail address as teh user name and type the gmail password.
    Click Next and dontinue following the steps till teh Summary, then click Save and Test.
    If the Test fails for any connectivity issue continmue following the steps below:
    Click the Network tab.
    Under the active connection type section click IPv4 (Wired / Wireless).
    Keep the IP Address Configuration as exists, under the DNS Address Configuration check the box next to Manual DNS Server.
    Set the Preferred DNS as 8.8.8.8
    Set the Alternate DNS as 8.8.4.4
    Click the Scan tab and click on Outgoing Email Profiles again.
    Click the Test button next to the Display Name configured earlier and check foir any difference.
    Shlomi
    Say thanks by clicking the Kudos thumb up in the post.
    If my post resolve your problem please mark it as an Accepted Solution

  • How to configure sap to use gmail as smtp server?

    Hi experts,
    I need to know how to configure gmail as my smtp server. In the scot transaction I don't see anywhere where to specify whether it is a ssh connection, ports for secure smtp, username, password.
    Does anyone know how to configure sap to use gmail as the smtp server?
    I've seen some similar threads about this, but they are of no help. Although they are classified as answered, in most cases the reason they are answered is because the person who made the query dropped the cause trying to make it work. I'd like to know for sure is this is possible or not.

    Hi Camilo,
    You can't set up gmail as your smtp server to handle this. gmail is an email server which generally are based on POP protocol. now for SAP to send mail to gmail, you would need one SMTP capable server which can relay those message received from SAP to configured email address.
    As of WAS 6.10 SAP kernel supports SMTP without more components. i.e e-mails can be sent (or received) from the SAP system to each SMTP-compatible mail server. see SAP note 455140 for more details.
    Hope this clarifies your doubt.
    http://en.wikipedia.org/wiki/SMTP_server
    Regards,
    Debasis.

  • How to use the gmail account using in smtp connection in ssis?

    hi 
    how to send the mails using send mail task to configure the smtp connection of the gmail account.
    Can you give me the name of that gmail server.
    TanX

    you might need to use script task for that as Sent Mail doesnt have option of authenticating
    http://dwteam.in/send-mail-in-ssis-using-gmail/
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Can gmail smtp server be used (requires authentication)

    I would like to configure my 10g XE environment with Apex to handle email.
    However, I don't want to set up an SMTP server on my environment. Instead I would like to route to the gmail smtp server.
    But gmail like many SMTP servers requires authentication and TLS security. Can authentication be coded into the calls or any suggestions on how to handle?
    Thanks,
    Stephen

    With an Virtual Directory solution, you can authenticate Iplanet Web Server against nearly anything including any LDAPv3 Directory Server, Microsoft Active Directory, Windows NT Domains, Oracle RDBMS, IBM DB2 RDBMS, Microsoft SQL, and others.
    All of this is done dynamically and doesn't require any heavyweight synchronization process. The Virtual Directory acts as a dynamic schema / DIT / data translation engine for different types of repositories.
    OctetString's Virtual Directory Engine is one such example. You can download a 30 day evaluation copy at:
    http://www.octetstring.com
    It will take you all of 30 minutes to get iPlanet Web Server authenticated against and using groups from things like Oracle RDBMS, Windows NT Domains, or Active Directory.

  • Javamail in jsp............for gmail smtp

    <%
    Properties props = new Properties();
    props.put("mail.smtp.starttls.enable","true");
    props.put("mail.host", "smtp.gmail.com");
    props.setProperty("mail.transport.protocol", "smtp");
    //          props.setProperty("mail.host", "smtp.gmail.com");
              props.put("mail.smtps.auth", "false");
              props.put("mail.smtps.port", "587");
              props.put("mail.smtps.socketFactory.port", "587");
              props.put("mail.smtps.socketFactory.class","javax.net.ssl.SSLSocketFactory");
            props.setProperty("mail.smtp.starttls.enable", "true");
              props.put("mail.smtps.socketFactory.fallback", "false");
              props.setProperty("mail.smtps.quitwait", "true");
    System.setProperty("mail.smtps.auth", "true");
    //Session s = Session.getInstance(props,null);
    Session sessions = Session.getInstance(props,
                        new javax.mail.Authenticator()
                   protected PasswordAuthentication getPasswordAuthentication()
                   { return new PasswordAuthentication("[email protected]","******************");     }
    InternetAddress from = new InternetAddress("[email protected]");
    InternetAddress to = new InternetAddress("[email protected]");
    MimeMessage message = new MimeMessage(sessions);
    message.setFrom(from);
    message.addRecipient(Message.RecipientType.TO, to);
    message.setSubject("Your subject");
    message.setText("Your text");
    com.sun.mail.smtp.SMTPSSLTransport.send(message);
    %>tred lot to find out got an error on server like:
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: An exception occurred processing JSP page /mailing.jsp at line 48
    45:
    46: message.setSubject("Your subject");
    47: message.setText("Your text");
    48: com.sun.mail.smtp.SMTPSSLTransport.send(message);
    49:
    50:
    51: %>
    Stacktrace:
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
    root cause
    javax.servlet.ServletException: com.sun.mail.smtp.SMTPSendFailedException: 530-5.5.1 Authentication Required. Learn more at                             
    530 5.5.1 http://mail.google.com/support/bin/answer.py?answer=14257 n6sm3422616wag.39
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:852)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
         org.apache.jsp.mailing_jsp._jspService(mailing_jsp.java:119)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
    root cause
    com.sun.mail.smtp.SMTPSendFailedException: 530-5.5.1 Authentication Required. Learn more at                             
    530 5.5.1 http://mail.google.com/support/bin/answer.py?answer=14257 n6sm3422616wag.39
         com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1668)
         com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1207)
         com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:735)
         javax.mail.Transport.send0(Transport.java:191)
         javax.mail.Transport.send(Transport.java:120)
         org.apache.jsp.mailing_jsp._jspService(mailing_jsp.java:103)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.
    Apache Tomcat/6.0.18help anyone................
    ***the code is proved is lots of searched work it has only the specifed error.
    Edited by: coolsayan.2009 on May 9, 2009 9:24 PM

    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: An exception occurred processing JSP page /mailing.jsp at line 48
    45:
    46: message.setSubject("Your subject");
    47: message.setText("Your text");
    48: com.sun.mail.smtp.SMTPSSLTransport.send(message);
    49:
    50:
    51: %>
    Stacktrace:
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
    root cause
    javax.servlet.ServletException: javax.mail.MessagingException: Could not connect to SMTP host: smtp.yahoo.com, port: 25;
      nested exception is:
         java.net.ConnectException: Connection timed out: connect
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:852)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
         org.apache.jsp.mailing_jsp._jspService(mailing_jsp.java:119)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
    root cause
    javax.mail.MessagingException: Could not connect to SMTP host: smtp.yahoo.com, port: 25;
      nested exception is:
         java.net.ConnectException: Connection timed out: connect
         com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1545)
         com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:453)
         javax.mail.Service.connect(Service.java:291)
         javax.mail.Service.connect(Service.java:172)
         javax.mail.Service.connect(Service.java:121)
         javax.mail.Transport.send0(Transport.java:190)
         javax.mail.Transport.send(Transport.java:120)
         org.apache.jsp.mailing_jsp._jspService(mailing_jsp.java:103)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
    root cause
    java.net.ConnectException: Connection timed out: connect
         java.net.PlainSocketImpl.socketConnect(Native Method)
         java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
         java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
         java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
         java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
         java.net.Socket.connect(Socket.java:519)
         java.net.Socket.connect(Socket.java:469)
         com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:267)
         com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:227)
         com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1511)
         com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:453)
         javax.mail.Service.connect(Service.java:291)
         javax.mail.Service.connect(Service.java:172)
         javax.mail.Service.connect(Service.java:121)
         javax.mail.Transport.send0(Transport.java:190)
         javax.mail.Transport.send(Transport.java:120)
         org.apache.jsp.mailing_jsp._jspService(mailing_jsp.java:103)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.
    Apache Tomcat/6.0.18this is the error with yahoo.

  • Failure to send email using gmail server

    I am using gmail account and I use thunderbird to download all the emails and to compose my emails. Now I'm trying to write a java application that will send out emails. Since I'm still in school I am using gmail account for the class project.
    One t hing I noticed is that in my thunderbird I use secure connection using TLS. How should I incorporate that here in the java code. Is that why I'm getting the exception. Anyone knows any other smtp server using which I could submit my assignment.
    Here is my code:
    package com.imagework.email;
    import java.util.Properties;
    import javax.mail.Authenticator;
    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.PasswordAuthentication;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeMessage;
    public class SendMailUsingAuthentication {
         private static final String SMTP_HOST_NAME = "smpt.gmail.com";
         private static final String SMTP_PORT = "587";     
         private static final String SMTP_AUTH_USER = "[email protected]";
         private static final String SMTP_AUTH_PWD = "abcde";
         private static final String emailMsgTxt = "email message text";
         private static final String emailSubjectTxt = "email subject";
         private static final String emailFromAddress = "[email protected]";
         // Add List of Email address to who email needs to be sent to separated by comma
         private static final String[] emailList = { "[email protected]" };
         public static void main(String args[]) throws Exception {
              SendMailUsingAuthentication smtpMailSender = new SendMailUsingAuthentication();
              smtpMailSender.postMail(emailList, emailSubjectTxt, emailMsgTxt,
                        emailFromAddress);
              System.out.println("Sucessfully Sent mail to All Users");
         public void postMail(String recipients[], String subject, String message,
                   String from) throws MessagingException {
              boolean debug = true;
              Properties props = new Properties();
              props.put("mail.smtp.host", SMTP_HOST_NAME);
              props.put("mail.smtp.auth", "true");
              props.put("mail.debug", "true");
              props.put("mail.smtp.user", SMTP_AUTH_USER);
              props.put("mail.smtp.password", SMTP_AUTH_PWD);          
              props.put("mail.smtp.port", SMTP_PORT );
              Authenticator auth = new SMTPAuthenticator();
              Session session = Session.getDefaultInstance(props, auth);
              session.setDebug(debug);
              Message msg = new MimeMessage(session);
              InternetAddress addressFrom = new InternetAddress(from);
              msg.setFrom(addressFrom);
              InternetAddress[] addressTo = new InternetAddress[recipients.length];
              for (int i = 0; i < recipients.length; i++) {
                   addressTo[i] = new InternetAddress(recipients);
              msg.setRecipients(Message.RecipientType.TO, addressTo);
              // Setting the Subject and Content Type
              msg.setSubject(subject);
              msg.setContent(message, "text/plain");
    //          Transport trans = session.getTransport();
    //          trans.connect(SMTP_HOST_NAME, SMTP_PORT , SMTP_AUTH_USER, SMTP_AUTH_PWD);
    //          trans.send(msg);
              Transport.send(msg);
         * SimpleAuthenticator is used to do simple authentication when the SMTP
         * server requires it.
         private class SMTPAuthenticator extends javax.mail.Authenticator {
              public PasswordAuthentication getPasswordAuthentication() {
                   String username = SMTP_AUTH_USER;
                   String password = SMTP_AUTH_PWD;
                   return new PasswordAuthentication(username, password);
    The error I get is given in detail:
    DEBUG: JavaMail version 1.3.1
    DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\j2re1.4.2_06\lib\javamail.providers (The system cannot find the file specified)
    DEBUG: !anyLoaded
    DEBUG: not loading resource: /META-INF/javamail.providers
    DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
    DEBUG: Tables of loaded providers
    DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]}
    DEBUG: Providers Listed By Protocol: {imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]}
    DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
    DEBUG: !anyLoaded
    DEBUG: not loading resource: /META-INF/javamail.address.map
    DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\j2re1.4.2_06\lib\javamail.address.map (The system cannot find the file specified)
    DEBUG: setDebug: JavaMail version 1.3.1
    DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
    DEBUG SMTP: useEhlo true, useAuth true
    DEBUG SMTP: useEhlo true, useAuth true
    DEBUG SMTP: trying to connect to host "smpt.gmail.com", port 587
    javax.mail.SendFailedException: Sending failed;
      nested exception is:
         class javax.mail.MessagingException: Unknown SMTP host: smpt.gmail.com;
      nested exception is:
         java.net.UnknownHostException: smpt.gmail.com
         at javax.mail.Transport.send0(Transport.java:218)
         at javax.mail.Transport.send(Transport.java:80)
         at com.imagework.email.SendMailUsingAuthentication.postMail(SendMailUsingAuthentication.java:70)
         at com.imagework.email.SendMailUsingAuthentication.main(SendMailUsingAuthentication.java:29)
    Exception in thread "main" All suggestions are welcome!
    - Roger

    Here is working code. I followed the instructions here, which, though it
    does not even mention SMTP, still works with SMTP:
    http://www.javaworld.com/javatips/jw-javatip115.html
    Look for the xxxxx occurances and substiture with your credentials :
    * Created on Feb 21, 2005
    import java.security.Security;
    import java.util.Properties;
    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.PasswordAuthentication;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeMessage;
    public class GoogleTest {
        private static final String SMTP_HOST_NAME = "smtp.gmail.com";
        private static final String SMTP_PORT = "465";
        private static final String emailMsgTxt = "Test Message Contents";
        private static final String emailSubjectTxt = "A test from gmail";
        private static final String emailFromAddress = "[email protected]";
        private static final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
        private static final String[] sendTo = { "[email protected]"};
        public static void main(String args[]) throws Exception {
            Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
            new GoogleTest().sendSSLMessage(sendTo, emailSubjectTxt,
                    emailMsgTxt, emailFromAddress);
            System.out.println("Sucessfully Sent mail to All Users");
        public void sendSSLMessage(String recipients[], String subject,
                String message, String from) throws MessagingException {
            boolean debug = true;
            Properties props = new Properties();
            props.put("mail.smtp.host", SMTP_HOST_NAME);
            props.put("mail.smtp.auth", "true");
            props.put("mail.debug", "true");
            props.put("mail.smtp.port", SMTP_PORT);
            props.put("mail.smtp.socketFactory.port", SMTP_PORT);
            props.put("mail.smtp.socketFactory.class", SSL_FACTORY);
            props.put("mail.smtp.socketFactory.fallback", "false");
            Session session = Session.getDefaultInstance(props,
                    new javax.mail.Authenticator() {
                        protected PasswordAuthentication getPasswordAuthentication() {
                            return new PasswordAuthentication("xxxxxx", "xxxxxx");
            session.setDebug(debug);
            Message msg = new MimeMessage(session);
            InternetAddress addressFrom = new InternetAddress(from);
            msg.setFrom(addressFrom);
            InternetAddress[] addressTo = new InternetAddress[recipients.length];
            for (int i = 0; i < recipients.length; i++) {
                addressTo[i] = new InternetAddress(recipients);
    msg.setRecipients(Message.RecipientType.TO, addressTo);
    // Setting the Subject and Content Type
    msg.setSubject(subject);
    msg.setContent(message, "text/plain");
    Transport.send(msg);
    [i]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How can i setup my E-Mail Configuration which can map to Gmail SMTP in Oats

    Hi Team,
    I would like to send the reports which i test to some gmail Id's using OATS E-mail Configuration,
    Can you please let me know what are the fields needs to entered
    SMTP Servers :
    When i Searched it says the following are the SMPT server
    smtp.gmail.com
    SSL Port 465
    StartTLS Port 587
    Please let me know which one to enter in the "SMTP Server" text box
    Return Address : Which address do we need to enter in this field
    Thanks and Waiting for your reply,
    Anand.

    I'm facing the same problem, who can help us ? what to enter into fields?

  • Sending mail with BPEL - using GMail account

    Tried to send an email via BPEL. I use my Gmail Account - which I've setup to use POP for outgoing mail.
    I've changed the settings in ns_emails accordingly:
    <EmailAccounts xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"
         EmailMimeCharset=""
         NotificationMode="EMAIL">
         <EmailAccount>
              <Name>Default</Name>
              <GeneralSettings>
                   <FromName>readsoft.consit</FromName>
                   <FromAddress>[email protected]</FromAddress>
              </GeneralSettings>
              <OutgoingServerSettings>
                   <SMTPHost>smtp.gmail.com</SMTPHost>
                   <SMTPPort>465</SMTPPort>
                   <AuthenticationRequired>true</AuthenticationRequired>
                   <UserName>[email protected]</UserName>
                   <Password>my_password_in_clear_text</Password>
                   <UseSSL>true</UseSSL>
              </OutgoingServerSettings>
              <IncomingServerSettings>
                   <Server>pop.gmail.com</Server>
                   <Port>999</Port>
                   <Protocol>pop3</Protocol>
                   <UserName>readsoft.consit</UserName>
                   <Password ns0:encrypted="false" xmlns:ns0="http://xmlns.oracle.com/ias/pcbpel/NotificationService">my_password_in_clear_text</Password>
                   <UseSSL>true</UseSSL>
                   <Folder>Inbox</Folder>
                   <PollingFrequency>1</PollingFrequency>
                   <PostReadOperation>
                        <MarkAsRead/>
                   </PostReadOperation>
              </IncomingServerSettings>
         </EmailAccount>
    But when I check the domain.log and it states that it still doesn't work:
    Domain.log:
    Notification via voice, fax, SMS, IM or pager will be sent.
    Emails will be sent with the current settings. If you would like to enable them, please configure accounts in ns_iaswconfig.xml and then set the NotificationMode attribute in ns_emails.xml to either NONE, EMAIL or ALL.
    Should I change somethin in iaswconfig.xml - and if yes - what?
    Rgds, Henrik

    Hi, Henrik:
    Please check out this post:
    Problem in sending Email notification from BPEL
    You need to get the right parameters of your Email server.(I also have a try of gmail server, it doesn't work. But my other email can take affect. So you can change another mail to have a try)
    Thanks,
    Melody

  • Configure Gmail SMTP Server

    Hi everybody
    I can´t configure configure my SMTP Server to send workflow notifications. I´ve try both protocols SSL and TLS. These are my properties:
    futuretense.ini:cs.emailauthenticator=com.openmarket.framework.mail.ICSAuthenticator
    futuretense.ini:cs.emailcontenttype=
    futuretense.ini:cs.emailhost=smtp.gmail.com\:465 or tls://smtp.gmail.com\:587
    futuretense.ini:cs.emailaccount=[email protected]
    futuretense.ini:cs.emailpassword=dummy123
    futuretense.ini:cs.emailcharset=
    futuretense.ini:cs.emailreturnto=
    The error is:
    (with SSL)
    [fatwire.logging.cs.xml] Error: mail.send failed! Message exception sending mail Sending failed;
      nested exception is:
      javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465
    (with TLS)
    [fatwire.logging.cs.xml] Error: mail.send failed! Message exception sending mail Sending failed;
      nested exception is:
      javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. ww4sm18327270wjc.47 - gsmtp

    Hi,
    I experienced a similar issue. It seems only standard SMTP is supported as of now. Oracle's workaround they offered me is to use a standard SMTP to forward mails to the required SMTP. I was testing stuff so I went for a mock SMTP server (although I don't think that is what you are looking for).
    Best regards,
    Pedro

  • After upgrade iPhoto will not email using Gmail.  Message " Your email did not go through because the server did not reply."

    After upgrading on both computers at work and at home, iPhoto will no longer email using Gmail (or for that matter any email program I can find).  I've tried the fixes of deleting all accounts in iPhoto and re-entering.   Still doesn't work.  Any other ideas?

    Hi Scooter,
    I'm reposting my response to a similar question here.
    Try this, assuming you're using iPhoto 11 and Mountain Lion:
    Within the iPhoto application, click on iPhoto in the menu bar
    Click on Preferences
    Within Preferences, click on Accounts
    Your Gmail account should be present. Click on Gmail under Accounts.
    Put in the proper information. Your full gmail address is your username (put this under Email address). Outgoing Mail Server is smtp.gmail.com   Port is 465   Password is your password.    Use Secure Sockets Layer (SSL) should be checked.
    Upon making these changes, click on the red "close" button in the top left corner of the pop-up window. Choose to Save Changes.
    Close iPhoto.
    Reopen iPhoto. You should now be able to share photos.
    I hope this helps. One suggestion for you, by the way. It's always best to include the application version and the operating system version you're using when asking for help. The above solution will not apply, at least exactly, to anything other than iPhoto 11 and Mountain Lion.
    Cheers,
    Jeff

  • Java Session problem while sending mail(using javamail) using Pl/SQL

    Hello ...
    i am using Java stored procedure to send mail. but i'm getting java session problem. means only once i can execute that procedure
    pls any help.

    props.put("smtp.gmail.com",host);I doubt javamail recognizes the 'smtp.gmail.com' property. I think it expects 'mail.host'. Of course since it cannot find a specified howt it assumes by default localhost
    Please format your code when you post the next time, there is a nice 'code' button above the post area.
    Mike

Maybe you are looking for

  • New imac as external monitor for macbook pro?

    I have a 2011 macbook pro that I use for work. I am thinking about buying the new imac for use at home. The question is can I use the imac as an external screen for my mbp? Or do I have to have another external monitor to use for that?

  • TXTing from iPhone to Droid (one sentence/line at a time)

    I have an iPhone 6, when I txt a friend who has a Droid, she receives one line at a time instead of the entire paragraph. Only with me, not her daughter who also has an iPhone. Any ideas what the problem might be?

  • Play button AS2 not working need help please!

    Hi, I have an AS2 project with two scenes, Scene 1 is has a pre-loader and Scene 2 has an embedded .flv animation from after effects with some other basic tweened shape layers and masks. I've used the Components UI and dragged a "Replay" button to th

  • FTP Adapter - 10.1.3.3 -Urgent !!!

    Hi, I am trying to configure get operation for FTP adapter (SOA Suite 10.1.3.3./ Jdev 10.1.3.3). Created an empty BPEL project, created a partner link and configured receive activiyt to invoke this PL and then rest of the steps. After deploying the p

  • How an Event (0BUSEVENT) works

    Hi, I would like to know what an event is and how it works. In Production Planning Standard Flow i could see a routine for 0MATERIAL Field in which 0BUSEVENT is used. 0BUSEVENT has values like PA,PB,PC,PD etc.. i would like to know what these values