Configuring a different mail Socket Factory

By default WebSphere Commerce mail uses javax.net.ssl.SSLSocketFactory for its Socket Factory. If you use a third-party mail service like Amazon Web Services or Microsoft Office 365, you might need to change the Socket Factory to javax.net.SocketFactory.

Procedure

  1. Navigate to the WAS_installdir/lib/ directory.
  2. Open the JCAEmailConnectionRequestInfo.properties properties file in a text editor. If it does not exist, create it.
  3. Update the configuration to suit your requirements.

    For a list of possible JavaMail configuration parameters, see the package description of com.sun.mail.smtp: Package com.sun.mail.smtp.

    For example, to change the Socket Factory to javax.net.SocketFactory, include the following line in your properties:
    mail.smtp.socketFactory.class=javax.net.SocketFactory
  4. Save and close the file.
  5. Restart the WebSphere Commerce Java virtual machine for the changes to take effect.
    Note: The following exception can be observed in the logs if the incorrect socketFactory.class set:
    Caused by: 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:1090)
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:986)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:197)
    at javax.mail.Service.connect(Service.java:313)
    at javax.mail.Service.connect(Service.java:172)
    at javax.mail.Service.connect(Service.java:121)
    at com.sun.mail.smtp.SMTPTransport.connect(SMTPTransport.java:104)
    at com.ibm.commerce.messaging.adapters.jcaemail.JCAEmailManagedConnection.init(JCAEmailManagedConnection.java:200)

Results

The Socket Factory and its settings are changed to the ones specified in the properties file.