Send emails from a distributed environment

We have multiple application servers with the same custom.properties setting - to use the middle server for sending email. Lately, (as more usage occurs on the platform) we have had complaints about email notifications not being sent but after we restart the node it works. I am wondering if maybe this one server can no longer handle the load for all but I don't have any test environments set up in the same manner to play around with the setting. Has anyone tinkered with having each app server set to use itself as the MAIL_SERVER (i.e. serverA has MAIL_SERVER_AND_PORT set to serverA, serverB has MAIL_SERVER_AND_PORT set to serverB?

I see this in my logs for today's occurrence:
2016-10-20 16:42:09,793 [Appian Work Item - 295831 - ProcessExec06 : SendNotificationRequest] WARN com.appiancorp.ap2.service.PortalNotificationServiceJavaImpl - A notification broadcast has been prevented b...

OriginalPostID-241929

  Discussion posts and replies are publicly visible

  • ...ecause the number of recipients [144] would exceed the configured limit of [100]. Adjust conf.notifications.MAX_RECIPIENTS to a value greater than [100] as necessary for future notifications.
    2016-10-20 16:42:46,548 [Appian Work Item - 295894 - ProcessExec05 : UnattendedJavaActivityRequest] ERROR com.appiancorp.ap2.mail.Mail - Could not send mail via mailhost.... to <validuser@validdomain.com>
    2016-10-20 16:42:46,564 [Appian Work Item - 295894 - ProcessExec05 : UnattendedJavaActivityRequest] ERROR com.appiancorp.process.runtime.activities.SendEmailActivity - javax.mail.MessagingException: Exception reading response;
    nested exception is:
    java.net.SocketException: Connection reset
    javax.mail.MessagingException: Exception reading response;
    nested exception is:
    java.net.SocketException: Connection reset
    at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2210)
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTra...
  • ...nsport.java:1950)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:642)
    at javax.mail.Service.connect(Service.java:295)
    at com.appiancorp.ap2.mail.Mail.sendMessage(Mail.java:328)
    at com.appiancorp.ap2.mail.Mail.sendMessage(Mail.java:220)
    at com.appiancorp.ap2.mail.Emailer.send(Emailer.java:124)
    at com.appiancorp.ap2.mail.Emailer.send(Emailer.java:119)
    at com.appiancorp.process.runtime.activities.SendEmailActivity.execute(SendEmailActivity.java:371)...
    Caused by: java.net.SocketException: Connection reset...

    Each application server has these settings in custom.properties:
    conf.suite.MAIL_SCHEME=http
    conf.suite.MAIL_SERVER_AND_PORT=ValidServerB:8080
    conf.mailhandler.ntf_sndr_addr=noreply@ValidDomain.com
    conf.mailhandler.email.domain=ValidDomain.com
    conf.mailhandler.mail.smtp.host=mailhost....

    Thanks.
  • I don't believe Appian will batch a single e-mail notification event notifications across multiple nodes. Each event will be sent to the e-mail server for that node...so an e-mail with 140 recipients would still fail if this is higher than your conf.notifications.MAX_RECIPIENTS setting.

    That being said...you can configure each JVM to talk to its own node as the e-mail server for resiliency and high availability.