Announcement Announcement Module
Collapse
No announcement yet.
problem sending an email with javamail Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • problem sending an email with javamail

    Hello guys
    i need really your help, my boss have a gun and .... i want to live,
    i cant send a simple email
    this is my xml configuration

    Code:
    <beans>
    <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"> 
       <property name="host"> 
       	<value>mail.yahoo.com</value>
        </property>
        <property name="username" >
       	<value>usernamesenderyahoo</value> <!-- same result if i write with @yahoo.com-->
        </property>
        <property name="password">
    	 <value>passwordsenderyahoo</value>
        </property>		    	    
        <property name="javaMailProperties">
            <props>
    	  <prop key="mail.smtp.auth">true</prop>
            </props>
        </property>
    </bean>
    		
    <bean id="messageSender" class="com.test.ComplexMessageSender" >
       <property name="javaMailSender">
    	<ref local="mailSender"/>
       </property>
       <property name="to">
    	<value>[email protected]</value>
       </property>
       <property name="from">
    	<value>[email protected]</value>
       </property>
       <property name="subject">
    	<value>Spring mail</value>
       </property>						
    </bean>			  
    </beans>
    when i start up the tomcat 5.5.27, by "ant" i execute a java class that call a bean

    Code:
    ComplexMessageSender plex = (ComplexMessageSender) ctx.getBean("messageSender");			
    plex.sendMessage();
    so after almost 3-5 minutes i recieve this prize

    Code:
     [java]    [java] EXCPETIONMail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: mail.yahoo.com, port: 25;
         [java] nested exception is:
         [java] java.net.ConnectException: Connection timed out
         [java] Stack
         [java] CLASEclass org.springframework.mail.MailSendException
         [java] org.springframework.mail.MailSendException; nested exceptions (0) are:
         [java] Caused by: javax.mail.MessagingException: Could not connect to SMTP host: mail.yahoo.com, port: 25;
         [java] nested exception is:
         [java] java.net.ConnectException: Connection timed out
         [java] at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1213)
         [java] at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:311)
         [java] at javax.mail.Service.connect(Service.java:233)
         [java] at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:373)
         [java] at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:326)
         [java] at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:341)
         [java] at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:330)
         [java] at com.test.ComplexMessageSender.sendMessage(Unknown Source)
         [java] at Manolo.pruebas(Unknown Source)
         [java] at Manolo.main(Unknown Source)
    BUILD SUCCESSFUL
    Total time: 5 minutes 17 seconds
    or the second prize is this
    Code:
     [java] EXCPETIONAuthentication failed; nested exception is javax.mail.AuthenticationFailedException
         [java] Stack
         [java] CLASEclass org.springframework.mail.MailAuthenticationException
         [java] org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException
         [java] Caused by: javax.mail.AuthenticationFailedException
         [java] at javax.mail.Service.connect(Service.java:264)
         [java] at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:373)
         [java] at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:326)
         [java] at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:341)
         [java] at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:330)
         [java] at com.test.ComplexMessageSender.sendMessage(Unknown Source)
         [java] at Manolo.pruebas(Unknown Source)
         [java] at Manolo.main(Unknown Source)
    i dont have any idea what could be wrong
    plse help!!!

    thanks for advanced
    Last edited by dr_pompeii; Jan 16th, 2007, 10:45 AM.

  • #2
    Just to be sure, have you tried to connect to SMTP server using telnet ?
    (http://www.yuki-onna.co.uk/email/smtp.html)

    Comment


    • #3
      I don't know if yahoo will play nicely or not. I have used gmail successfully before, but these services are sometimes changed from time to time to prevent spam and such like. I would google the problem, there are lots of responses out there.

      e.g.
      http://forum.java.sun.com/thread.jspa?threadID=244595
      http://saloon.javaranch.com/45/000783.html

      Comment


      • #4
        Hello guys
        thanks for your reply both
        well by order

        pgras
        thanks again
        i saw your link so, if i try in linux this

        Code:
        well after a long delay i recieve again these prize 
        [user@localhost ~]$ telnet mail.yahoo.com 25
        Trying 209.191.92.114...
        telnet: connect to address 209.191.92.114: Connection timed out
        telnet: Unable to connect to remote host: Connection timed out
        [user@localhost ~]$
        or
        [user@localhost ~]$ telnet gmail.com 25 <---- check the way
        Trying 216.239.57.83...
        telnet: connect to address 216.239.57.83: Connection timed out
        Trying 64.233.161.83...
        
        [user@localhost ~]$ telnet mail.gmail.com 25 <---- no work!
        Trying 216.239.57.83...
        telnet: connect to address 216.239.57.83: Connection timed out
        Trying 64.233.161.83...
        telnet: connect to address 64.233.161.83: Connection timed out
        Trying 64.233.171.83...
        so the obvious way , no work , sad but true

        only works for hotmail
        Code:
        [user@localhost ~]$ telnet mail.hotmail.com 25
        Trying 65.54.244.8...
        Connected to mail.hotmail.com (65.54.244.8).
        Escape character is '^]'.
        220 bay0-mc6-f18.bay0.hotmail.com Sending unsolicited commercial or bulk e-mail to Microsoft's computer network is prohibited. Other restrictions are found at http://privacy.msn.com/Anti-spam/. Violations will result in use of equipment located in California and other states. Tue, 16 Jan 2007 17:31:59 -0800
        Connection closed by foreign host.
        like playing
        i found that in these ways works
        Code:
        [user@localhost ~]$ telnet smtp.gmail.com 25
        Trying 66.249.83.109...
        Connected to smtp.gmail.com (66.249.83.109).
        Escape character is '^]'.
        220 mx.google.com ESMTP i35sm12344483wxd
        
        [user@localhost ~]$  telnet smtp.mail.yahoo.com 25
        Trying 68.142.203.143...
        Connected to smtp.mail.yahoo.com (68.142.203.143).
        Escape character is '^]'.
        220 smtp106.plus.mail.mud.yahoo.com ESMTP
        quit
        221 smtp106.plus.mail.mud.yahoo.com
        Connection closed by foreign host.
        [user@localhost ~]$
        now with this configuration for gmail
        Code:
        <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"> 
            <property name="host"> 
            	<value>smtp.gmail.com</value>
            </property>
            <property name="port"> 
            	<value>25</value>
            </property>
            <property name="username" >
            	<value>usernameforgamil</value>
            </property>
            <property name="password">
        	<value>billgateslovejava</value>
            </property>		    	    
            <property name="javaMailProperties">
                <props>
        	  <prop key="mail.smtp.auth">true</prop>
          	</props>
            </property>
        </bean>
        		
        <bean id="messageSender" class="com.test.ComplexMessageSender" >
        	<property name="javaMailSender">
        		<ref local="mailSender"/>
        	</property>
        	<property name="to">
        		<value>[email protected]</value>
        	</property>
        	<property name="from">
        		<value>[email protected]</value>
        	</property>
        	<property name="subject">
        		<value>Spring mail</value>
        	</property>						
        </bean>
        i recieve this

        Code:
        [java] EXCPETIONFailed messages: com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first i20sm12364936wxd
             [java] Stack
             [java] org.springframework.mail.MailSendException; nested exception details (1) are:
             [java] Failed message 1:
             [java] com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first i20sm12364936wxd
             [java] at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1275)
             [java] at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:895)
             [java] at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:524)
             [java] at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:382)
             [java] at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:326)
             [java] at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:341)
             [java] at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:330)
             [java] at com.test.ComplexMessageSender.sendMessage(Unknown Source)
             [java] at Manolo.pruebas(Unknown Source)
             [java] at Manolo.main(Unknown Source)
             [java] CLASEclass org.springframework.mail.MailSendException
        for yahoo configuration, i recieve this
        Code:
             [java] EXCPETIONAuthentication failed; nested exception is javax.mail.AuthenticationFailedException
             [java] Stack
             [java] org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException
             [java] Caused by: javax.mail.AuthenticationFailedException
             [java] at javax.mail.Service.connect(Service.java:264)
             [java] at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:373)
             [java] at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:326)
             [java] at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:341)
             [java] at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:330)
             [java] at com.test.ComplexMessageSender.sendMessage(Unknown Source)
             [java] at Manolo.pruebas(Unknown Source)
             [java] at Manolo.main(Unknown Source)
             [java] CLASEclass org.springframework.mail.MailAuthenticationException
        Dear friend karldmoore
        how always thanks for your time and the links
        i saw the javaranch, so i have already open the SMTP (for incoming request, i can find the inverse - out, i use firestarter in FC5)

        but i still have the circus of error.

        pls help!!!

        BTW
        for hotmail i recieve this
        Code:
            [java] EXCPETIONAuthentication failed; nested exception is javax.mail.AuthenticationFailedException
             [java] Stack
             [java] CLASEclass org.springframework.mail.MailAuthenticationException
             [java] org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException
             [java] Caused by: javax.mail.AuthenticationFailedException
             [java] at javax.mail.Service.connect(Service.java:264)
             [java] at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:373)
             [java] at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:326)
             [java] at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:341)
             [java] at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:330)
             [java] at com.test.ComplexMessageSender.sendMessage(Unknown Source)
             [java] at Manolo.pruebas(Unknown Source)
             [java] at Manolo.main(Unknown Source)
        regards
        Last edited by dr_pompeii; Jan 16th, 2007, 09:00 PM. Reason: i forgot exception for hotmail

        Comment


        • #5
          I'd try googling this an going through the results. As I said before, they do mess with the settings on these things. I've had gmail working one week and not the next, very frustrating.

          Comment


          • #6
            Hello karldmoore

            As I said before, they do mess with the settings on these things.
            jesus, i must shoot them

            I've had gmail working one week and not the next, very frustrating.
            really very frustrating., each count should has an option to let send by java mail (to avoid possible false spams) - a solution

            i had an old project with java mail 2 years ago, but without Spirng, and always works, was with a count in http://www.cwazy.net/, (see its features ), i never had problems with that, but now is not free anymore

            maybe other member of the forum use other server for email , and share a link

            thanks for advanced

            Comment


            • #7
              There are lots of threads out there, I guess you just have to look through them.

              e.g.
              http://forum.java.sun.com/thread.jsp...sageID=4292920

              Comment


              • #8
                Hello karldmoore

                this is a golden link, his code works!
                jesus!!!

                i am using the 2 java classes by Pro Spring (free source code)
                the unique difference is the Authenticator

                regards

                Comment


                • #9
                  To send mail over an authenticated connection, you need to setup the Session with an Authenticator implementation. That's not provided by Spring out of the box, but you can easily wire in your own implementation. For gmail, you'd do something like this:
                  Code:
                  <?xml version="1.0" encoding="UTF-8"?>
                  <beans xmlns="http://www.springframework.org/schema/beans"
                  	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  	xsi:schemaLocation="http://www.springframework.org/schema/beans
                  							http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
                  
                          <!-- our Authenticator implementation -->
                  	<bean id="smtpAuthenticator"
                  		class="forums.mailtest.SmtpAuthenticator">
                  		<constructor-arg value="[email protected]" />
                  		<constructor-arg value="password" />
                  	</bean>
                  
                          <!-- now setup an authenticated session -->
                  	<bean id="mailSession" class="javax.mail.Session"
                  		factory-method="getInstance">
                  		<constructor-arg>
                  			<props>
                  				<prop key="mail.smtp.auth">true</prop>
                  				<prop key="mail.smtp.socketFactory.port">465</prop>
                  				<prop key="mail.smtp.socketFactory.class">
                  					javax.net.ssl.SSLSocketFactory
                  				</prop>
                  				<prop key="mail.smtp.socketFactory.fallback">
                  					false
                  				</prop>
                  			</props>
                  		</constructor-arg>
                  		<constructor-arg ref="smtpAuthenticator" />
                  	</bean>
                  
                          <!-- and configure the MailSender with the authenticated session -->
                  	<bean id="mailSender"
                  		class="org.springframework.mail.javamail.JavaMailSenderImpl">
                  		<property name="host" value="smtp.gmail.com" />
                  		<property name="session" ref="mailSession" />
                  	</bean>
                  
                  	<!-- this is a template message that we can pre-load with default state -->
                  	<bean id="templateMessage"
                  		class="org.springframework.mail.SimpleMailMessage">
                  		<property name="from" value="[email protected]" />
                  		<property name="subject" value="Testing" />
                  	</bean>
                  
                  	<bean id="mailTest" class="forums.mailtest.MailTest">
                  		<constructor-arg ref="mailSender" />
                  		<constructor-arg ref="templateMessage" />
                  	</bean>
                  </beans>
                  You need your own Authenticator implementation, which could be something like this:
                  Code:
                  package forums.mailtest;
                  
                  import javax.mail.Authenticator;
                  import javax.mail.PasswordAuthentication;
                  
                  public class SmtpAuthenticator extends Authenticator {
                  	private String username;
                  	private String password;
                  	
                  	public SmtpAuthenticator(String username, String password) {
                  		super();
                  		this.username = username;
                  		this.password = password;
                  	}
                  
                  	public PasswordAuthentication getPasswordAuthentication() {
                                  return new PasswordAuthentication(username, password);
                  	}
                  }
                  And here's the test class to send the actual message:
                  Code:
                  package forums.mailtest;
                  
                  import org.springframework.context.ApplicationContext;
                  import org.springframework.context.support.ClassPathXmlApplicationContext;
                  import org.springframework.mail.MailException;
                  import org.springframework.mail.MailSender;
                  import org.springframework.mail.SimpleMailMessage;
                  
                  public class MailTest {
                  	private MailSender mailSender;
                  	private SimpleMailMessage templateMessage;
                  	public MailTest(MailSender mailSender, SimpleMailMessage templateMessage) {
                  		super();
                  		this.mailSender = mailSender;
                  		this.templateMessage = templateMessage;
                  	}
                  	
                  	public void sendMeMail() {
                  		SimpleMailMessage msg = new SimpleMailMessage(templateMessage);
                  		msg.setTo("[email protected]");
                  		msg.setText("This is a test.\nGo Spring!\n");
                  		try {
                  			this.mailSender.send(msg);
                  		} catch (MailException e) {
                  			System.err.println("Didn't work.");
                  			e.printStackTrace();
                  		}
                  	}
                  	
                  	public static final void main(String[] args) {
                  		ApplicationContext appCtx = new ClassPathXmlApplicationContext(new String[] {
                  				"forums/mailtest/application-config.xml"
                  		});
                  		
                  		MailTest tester = (MailTest) appCtx.getBean("mailTest");
                  		tester.sendMeMail();
                  	}
                  }
                  Note that you should google for the connection settings for whatever mail server you're trying to use to send mail. For gmail, they're here:
                  http://mail.google.com/support/bin/a...y?answer=13287

                  I think yahoo and gmail both want you to use authentication, and you may need to use a different port for each.

                  Comment


                  • #10
                    Wow dr_pompeii, we found some code that works? Lets just hope they don't change anything an it carries on working! Glad its sorted anyway!

                    Comment


                    • #11
                      Hello guys

                      by order

                      ostewart - thanks so much for your code!!!!
                      well, after seen the link of our friend karldmoore, i did my own code (early morning), but tonight i conclude that your code looks much better - thanks!!!

                      changing the theme, i saw this part factory-method, first time that i see that,
                      well, reading here more documentation http://www.springframework.org/docs/...nce/beans.html
                      the factory-method is for static methods like the getInstance of Session class
                      http://java.sun.com/products/javamai...l/Session.html

                      i have a simple doubt , here 3.3.1.3. Some examples, i can see the follow example
                      Code:
                      <bean id="exampleBean" class="examples.ExampleBean"
                            factory-method="createInstance">
                        <constructor-arg ref="anotherExampleBean"/>
                        <constructor-arg ref="yetAnotherBean"/>
                        <constructor-arg value="1"/> 
                      </bean>
                      
                      <bean id="anotherExampleBean" class="examples.AnotherBean"/>
                      <bean id="yetAnotherBean" class="examples.YetAnotherBean"/>
                      
                      public class ExampleBean {
                      ...    
                          public static ExampleBean createInstance (
                                  AnotherBean anotherBean, YetAnotherBean yetAnotherBean, int i) {
                              ExampleBean eb = new ExampleBean (...);
                              // some other operations
                              ...
                              return eb;
                          }
                      the question is if i have other static method (createInstancebeta with the sames arguments for example), how i should declare the other method in the <bean ...., because i can see that the Session class, has more static methods

                      karldmoore
                      Wow dr_pompeii, we found some code that works? Lets just hope they don't change anything an it carries on working! Glad its sorted anyway!
                      lol, yes man, i do thinking both should buy a lotery

                      really thanks so much for your time and effort guys,
                      my boss sold his gun

                      Comment


                      • #12
                        Yes...all perfect but...

                        Hi,
                        I'm an italian boy...and i'm sorry for my english!!!
                        well...
                        the configuration for send email through spring whit gmail account is perfect but I send email only from my gmail address to my gmail address!!!
                        do you know why ??? help me please!!!
                        thanks!!!

                        Comment


                        • #13
                          I'm Sorry

                          I'M Sorry for my previous post....
                          the configuration is perfec....
                          the mail server is slow tonight!!!
                          BYE BYE!!!

                          Comment


                          • #14
                            Connection Timeout!

                            Hi Im having problems with sending out emails. Would appreciate help

                            GidWS.java
                            Code:
                            public class GidWS {
                            
                            	private MailSender mailSender;
                                private SimpleMailMessage templateMessage;
                            
                                public void setMailSender(MailSender mailSender) {
                                    this.mailSender = mailSender;
                                }
                            
                                public void setTemplateMessage(SimpleMailMessage templateMessage) {
                                    this.templateMessage = templateMessage;
                                }
                            	
                                public void sendMeMail() {
                                	
                                	SimpleMailMessage msg = new SimpleMailMessage(this.templateMessage);
                                    msg.setTo("[email protected]");
                            		msg.setText("Testing Mail.....");
                            		 try{
                            			 
                            	            this.mailSender.send(msg);
                            	        }
                            	        catch(MailException ex) {
                            	           
                            	            System.err.println(ex.getMessage()); 
                            	            ex.printStackTrace();
                            	        }
                                    }
                            
                            	public static void main(String[] args) {
                            		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("gid.xml", GidWS.class);
                            		String requestXml =
                            				"<hr:CompanyRequest xmlns:hr=\"http://mycompany.com/hr/schemas\">" +
                            				"<hr:Company>"+
                            		        "<hr:CompanyName>GetAllCompanies</hr:CompanyName>"+
                            	            "</hr:Company>"+
                                            "</hr:CompanyRequest>";
                            
                            		Message<String> message = MessageBuilder.fromPayload(requestXml)
                            				.setHeader(AbstractWebServiceHandler.SOAP_ACTION_PROPERTY_KEY, "http://mycompany.com/hr/schemas")
                            				.build();
                            
                            		((MessageChannel)context.getBean("sendChannel")).send(message);
                            		
                            		GidWS mailtester=(GidWS)context.getBean("msgManager");
                            		mailtester.sendMeMail();
                            		
                            }
                            SmtpAuthenticator.java
                            Code:
                            public class SmtpAuthenticator extends Authenticator {
                            	
                            	private String username;
                            	private String password;
                            	
                            	public SmtpAuthenticator(String username, String password) {
                            		super();
                            		this.username = username;
                            		this.password = password;
                            	}
                            
                            	public PasswordAuthentication getPasswordAuthentication() {
                                            return new PasswordAuthentication(username, password);
                            	}
                            	
                            }
                            gid.xml
                            Code:
                            <message-bus/>
                            	<publish-subscribe-channel id="sendChannel"/>
                            	<!-- The service activator receives from the 'sendChannel',
                            	     invokes the handler, and sends the reply Message to the 'replyChannel'. -->
                            	<service-activator input-channel="sendChannel" ref="msgConverter1" output-channel="replyChannel1"/>
                            	<!-- The handler invokes the WebService for the given URI and returns a reply Message. -->
                            	<ws-handler id="msgConverter1" uri="http://localhost:8080/Trial1/companyservice"/>
                            	<!-- The response from the service is logged to the console. -->
                            	<channel-adapter id="replyChannel1" target="console"/>
                            	<console-target id="console"/>
                            	<beans:bean id="msgManager" class="org.springframework.integration.gidb.ws.GidWS">
                            		<beans:property name="mailSender" ref="mailSender"/>
                            		<beans:property name="templateMessage" ref="templateMessage"/>
                            	</beans:bean>
                            	<beans:bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
                            		<beans:property name="host" value="66.249.93.109"/>
                            		<beans:property name="session" ref="mailSession" />
                            	</beans:bean>
                            	
                            <beans:bean id="mailSession" class="javax.mail.Session"
                            		factory-method="getInstance">
                            		<beans:constructor-arg>
                            			<beans:props>
                            				<beans:prop key="mail.smtp.auth">true</beans:prop>
                            				<beans:prop key="mail.smtp.starttls.enable">true</beans:prop>
                            				<beans:prop key="mail.smtp.debug">true</beans:prop>
                            				<beans:prop key="mail.smtp.socketFactory.port">465</beans:prop>
                            				<beans:prop key="mail.smtp.socketFactory.class">
                            					javax.net.ssl.SSLSocketFactory
                            				</beans:prop>
                            				<beans:prop key="mail.smtp.socketFactory.fallback">
                            					false
                            				</beans:prop>
                            			</beans:props>
                            Error Message
                            Code:
                            nested exception is:
                            	java.net.ConnectException: Connection timed out: connect
                            org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: 66.249.93.109, port: 25;
                              nested exception is:
                            	java.net.ConnectException: Connection timed out: connect
                            	at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:419)
                            	at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:308)
                            	at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:297)
                            	at org.springframework.integration.gidb.ws.GidWS.sendMeMail(GidWS.java:36)
                            	at org.springframework.integration.gidb.ws.GidWS.main(GidWS.java:81)
                            Caused by: javax.mail.MessagingException: Could not connect to SMTP host: 66.249.93.109, port: 25;
                              nested exception is:
                            	java.net.ConnectException: Connection timed out: connect
                            	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
                            	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
                            	at javax.mail.Service.connect(Service.java:310)
                            	at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:389)
                            	... 4 more
                            Caused by: java.net.ConnectException: Connection timed out: connect
                            	at java.net.PlainSocketImpl.socketConnect(Native Method)
                            	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
                            	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
                            	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
                            	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
                            	at java.net.Socket.connect(Socket.java:520)
                            	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:545)
                            	at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:141)
                            	at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:233)
                            	at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:163)
                            	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1359)
                            	... 7 more

                            Comment


                            • #15
                              This does not work anymore. Once I get it working, I will post a solution. Most likely the port value has changed with gmail.

                              Comment

                              Working...
                              X