<div dir="ltr">Hi, guys.<div><br></div><div>I had problem sending error mail notifications on amazon aws windows instance,<br>while regular mail was fine and linux instance (w\ newer tomcat as well) was fine.<br><br>Since I already had my own Suspendable- and Batching- extensions of SMTPAppender,<br>I changed Session and Transport handling to overcome it, see introduced methods below.</div><div>But I wonder if I missed something which could be done thru config.</div><div>Options I use are</div><div><div><div><SSL>true</SSL></div></div><div><smtpHost><a href="http://email-smtp.eu-west-1.amazonaws.com" target="_blank">email-smtp.eu-west-<wbr>1.amazonaws.com</a></smtpHost><br></div><div><smtpPort>465</smtpPort></div><div><username>...</username></div><div><password>...</password></div><div><div><from>...</from><br></div></div><div><to>...</to></div><br></div><div><div>protected void put(Properties props, String key, String value) {</div><div>    if (value != null) {</div><div>        String key1 = !isSSL() ? key : key.replace(".smtp.", ".smtps.");</div><div>        props.put(key1, value);</div><div>    }</div><div>}</div><div>protected Session rebuildSessionFromProperties() {</div><div>    Properties props = new Properties(OptionHelper.<wbr>getSystemProperties());</div><div>    put(props, "mail.smtp.localhost", getLocalhost());</div><div>    if (isSTARTTLS() && isSSL()) {</div><div>        addError("Both SSL and StartTLS cannot be enabled simultaneously");</div><div>    } else if (isSTARTTLS()) {</div><div>        props.put("mail.smtp.starttls.<wbr>enable", "true");</div><div>    } else if (isSSL()) {</div><div>        props.put("mail.smtps.ssl.<wbr>enable", "true");</div><div>    }</div><div>    return Session.getInstance(props);<br></div><div>}</div></div><div><br></div><div><div><br></div></div><div><div>protected void sendMessage(MimeMessage mimeMsg)</div><div>        throws MessagingException {</div><div>    addInfo("About to send out SMTP message \"" + mimeMsg.getSubject()</div><div>        + "\" to " + Arrays.asList(mimeMsg.<wbr>getAllRecipients()));</div><div>    mimeMsg.saveChanges();</div><div>    Transport transport = session.getTransport(isSSL() ? "smtps" : "smtp");</div><div>    if (getUsername() == null) {</div><div>        transport.connect();</div><div>    } else if (getSmtpHost() == null) {</div><div>        transport.connect(getUsername(<wbr>), getPassword());</div><div>    } else {</div><div>        transport.connect(getSmtpHost(<wbr>), getSmtpPort(), getUsername(), getPassword());</div><div>    }</div><div>    try {</div><div>        transport.sendMessage(mimeMsg, mimeMsg.getAllRecipients());</div><div>    } finally {</div><div>        if (transport.isConnected()) {</div><div>            transport.close();</div><div>        }</div><div>    }</div><div>}</div></div><div><br></div></div>