You are currently reviewing an older revision of this page.

DRAFT:KB-XXXX System emails/process emails are not sent with "Email body failed to render... Connection refused" error

Symptoms

When attempting to reset a password or use the Send Email Smart Service, the email fails to deliver.

With DEBUG logging turned on, the application server log will show the the following:

YYYY-MM-DD HH:MM:ss [Appian Work Item - 581 - NotificationsEmail : MailRequest] DEBUG com.appiancorp.process.engine.MailBody - lastName -> <LASTNAME>
YYYY-MM-DD HH:MM:ss [Appian Work Item - 581 - NotificationsEmail : MailRequest] DEBUG com.appiancorp.process.engine.MailBody - admin_username -> <ADMIN_USERNAME>
YYYY-MM-DD HH:MM:ss [Appian Work Item - 581 - NotificationsEmail : MailRequest] DEBUG com.appiancorp.process.engine.MailBody - tz -> <TIME_ZONE>
YYYY-MM-DD HH:MM:ss [Appian Work Item - 581 - NotificationsEmail : MailRequest] DEBUG com.appiancorp.process.engine.MailBody - admin_lastName -> <ADMIN_LASTNAME>
YYYY-MM-DD HH:MM:ss [Appian Work Item - 581 - NotificationsEmail : MailRequest] DEBUG com.appiancorp.process.engine.MailBody - admin_email -> <ADMIN_EMAIL>
YYYY-MM-DD HH:MM:ss [Appian Work Item - 581 - NotificationsEmail : MailRequest] DEBUG com.appiancorp.process.engine.MailBody - firstName -> <FIRST_NAME>
YYYY-MM-DD HH:MM:ss [Appian Work Item - 581 - NotificationsEmail : MailRequest] DEBUG com.appiancorp.process.engine.MailBody - temporaryPassword -> <TEMP_PASSWORD>
YYYY-MM-DD HH:MM:ss [Appian Work Item - 581 - NotificationsEmail : MailRequest] DEBUG com.appiancorp.process.engine.MailBody - calendarId -> <CALENDAR_TYPE>
YYYY-MM-DD HH:MM:ss [Appian Work Item - 581 - NotificationsEmail : MailRequest] DEBUG com.appiancorp.process.engine.MailBody - taskLink -> <TASK_LINK>
YYYY-MM-DD HH:MM:ss [Appian Work Item - 581 - NotificationsEmail : MailRequest] DEBUG com.appiancorp.process.engine.MailBody - admin_firstName -> <ADMIN_FIRSTNAME
YYYY-MM-DD HH:MM:ss [Appian Work Item - 581 - NotificationsEmail : MailRequest] DEBUG com.appiancorp.process.engine.MailBody - loginPageLink -> <LOGIN_PAGE>
YYYY-MM-DD HH:MM:ss [Appian Work Item - 581 - NotificationsEmail : MailRequest] DEBUG com.appiancorp.process.engine.MailBody - lang -> <LANGUAGE>
YYYY-MM-DD HH:MM:ss [Appian Work Item - 581 - NotificationsEmail : MailRequest] DEBUG com.appiancorp.process.engine.MailBody - timesent -> <TIME_SENT>
YYYY-MM-DD HH:MM:ss [Appian Work Item - 581 - NotificationsEmail : MailRequest] DEBUG com.appiancorp.process.engine.MailBody - email -> <EMAIL>
YYYY-MM-DD HH:MM:ss [Appian Work Item - 581 - NotificationsEmail : MailRequest] DEBUG com.appiancorp.process.engine.MailBody - username -> <USERNAME>

However, the application server log will also show the following error:

Exception:
javax.resource.spi.work.WorkCompletedException: com.appiancorp.process.engine.EmailBodyException: Email body failed to render: MailBody{<FILE_PATH_TO_EMAIL_TEMPLATE>}
...
Caused by: javax.ejb.EJBException: com.appiancorp.process.engine.EmailBodyException: Email body failed to render: MailBody{<FILE_PATH_TO_EMAIL_TEMPLATE>}
...
Caused by: com.appiancorp.process.engine.EmailBodyException: Email body failed to render: MailBody{<FILE_PATH_TO_EMAIL_TEMPLATE>}
...
Caused by: java.net.ConnectException: Connection refused (Connection refused)

Cause

This error is seen when an Appian environment is configured with a web server to use HTTPS/SSL scheme. All email requests in Appian are routed through the server specified in the conf.suite.SERVER_AND_PORT property, unless values are given for conf.suite.MAIL_SCHEME and conf.suite.MAIL_SERVER_AND_PORT. These values are specified in the custom.properties file located in:

  • <APPIAN_HOME>/conf for Appian 18.2 and later.
  • <APPIAN_HOME>/ear/suite.ear/conf for Appian 18.1 and earlier.

The above symptoms are a result of Appian attempting to route email requests from the application server to the web server. As the web server has been configured with SSL, the application server needs to use SSL for creating the email body. By default, the application server does not have the necessary certificates to create this connection and thus it fails to create the email body.

This could occur when there is a miss-match between the hosts file and the server/port for the mail server.

Action

The error can be resolved by using the application server to create the email body instead of the web server. Change/add the following lines in the custom.properties file:

conf.suite.MAIL_SCHEME=http
conf.suite.MAIL_SERVER_AND_PORT=localhost:<APP_SERVER_PORT>

Save the file and restart the application server for the changes to take effect. 

Affected Versions

This article applies to all versions of Appian. 

Last Reviewed: April 2019