Menu

More email woes - SSL

Help
2011-03-15
2013-05-23
  • Bruce Redmon

    Bruce Redmon - 2011-03-15

    I've completed all configuration items and the application successful connects with a Postgres 9 DB.  However in an attempt to register I throw one of two possible email errors.

    If I attempt a connection to standard port 25, I see this errror in the catalina.out log:

    14-03-2011 17:46:32  UserManagerImpl.register(85): Unable to send confirmation notification
    org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Exception reading response;
      nested exception is:
            javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?. Failed messages: javax.mail.MessagingException: Exception reading response;
      nested exception is:
            javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?; message exception details (1) are:
    Failed message 1:
    javax.mail.MessagingException: Exception reading response;
      nested exception is:
            javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
            at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1462)
            at …

    If I configure to use our SSL port on our mail server, I receive the following:

    15-03-2011 14:39:37  UserManagerImpl.register(85): Unable to send confirmation notification
    org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Exception reading response;
      nested exception is:
            javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target. Failed messages: javax.mail.MessagingException: Exception reading response;
      nested exception is:
            javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; message exception details (1) are:
    Failed message 1:
    javax.mail.MessagingException: Exception reading response;
      nested exception is:
            javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
            at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1462)
            at …

    which appears to require a cert from the mail server.

    I noticed in applicationContextNotification.xml the following line in the mailer bean:

                <prop key="mail.smtp.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>

    Does this class require SSL or is it possible to use an non SSL conenction to the mail server?

    Many Thanks.

     
  • adam

    adam - 2011-03-15

    Make sure your applicationContextNotification.xml has ssl and tls settings commented out as they are only required for gmail. The mailer configuration in that file should look like this:

    <bean id="mailer" class="org.springframework.mail.javamail.JavaMailSenderImpl"
             p:host="${mail.host}" p:username="${mail.username}" p:password="${mail.password}"
             p:port="${mail.port}">
          <property name="javaMailProperties">
             <props>
                <prop key="mail.smtp.localhost">localhost</prop>
                <prop key="mail.smtp.auth">${mail.authenticate}</prop>
                <!--<prop key="mail.smtp.starttls.enable">true</prop>-->
                <!--<prop key="mail.smtp.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>-->
                <!--<prop key="mail.smtp.socketFactory.port">${mail.port}</prop>-->
             </props>
          </property>
       </bean>
    
     
  • Bruce Redmon

    Bruce Redmon - 2011-03-15

    Thanks!  That did the trick.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.