Configuring the SMTP Server for Closed Mail Relay
Configuring the SMTP server for closed mail relay
To set up an SMTP server for closed mail relay, you must configure the following properties in the is.properties file. You must ensure that all properties are configured correctly and none of them are left blank.
|
While switching mail relay systems, you must consider the following:
• A server restart is required if you are switching mail relays.
• A server restart is required if you make any changes to any of these properties while using the closed mail relay system.
|
• mksis.smtp.authentication — Set the value to true to send mails using the closed mail relay. Setting this property to false enables the application to send e-mails using the open mail relay.
• mksis.smtp.ssl.enabled — Set the value to true to enable TLS encryption on the SMTP server. You can use this option only when your SMTP server is configured with TLS encryption using the Signer certificate. If your SMTP server is configured with TLS encryption, then you can use the keytool.exe command to import the Signer certificates (custom root CAs or custom intermediate CAs) from the SMTP server into your trusted keystore. The keytool.exe command is located in your JRE/JDK folder.
%jdk%\bin\keytool -importcert -alias <<SMTP Server name>> -storetype PKCS12
-keystore jdk\lib\security\cacerts
-file <custome_CA_certificate>
where
-importcert - specifies to import the certificate response
-alias - specifies the name of the entry from which to import
-file - specifies the path from which to read the CA response
You must repeat the command for all the CAs.
• mksis.logging.email.from — Contains the authentication user name of the sender
• mksis.logging.emailfrom.password — Contains the password
• mksis.logging.email.server.hostname — Contains the name of the SMTP server.
• mksis.logging.email.server.port — Contains the port number
|
After adding or modifying the authentication user name and password, save the is.properties file and run the encryption tool. This ensures that the password provided in the is.properties file are encrypted.
|
E-mail triggers
If you want to continue using the open mail relay, no changes are required and the triggers should continue to function as expected. In case you are moving to SMTP closed mail relay system, you must configure the is.properties file as mentioned above and also make the following changes to the out-of-the-box trigger scripts provided with the application:
• If you are using Java Mail API and the sample trigger script (emailAdvanced_closedmail.js), you must ensure to use an appropriate encryption technique to retrieve authentication details from getSMTPUserName() and getSMTPPassword() functions. The following is a code snippet you can use:
// NOTE: SMTP closed mail configuration requires username and password to send
// e-mails. As storing plain-text password is not recommended, using an appropriate encryption
// technique is recommended in retrieving authentication details from getSMTPUserName(),
// getSMTPPassword() functions.
function getSMTPUserName()
{
var smtpUsername = null;
return smtpUsername;
}
function getSMTPPassword()
{
var smtpPassword = null;
return smtpPassword;
}
//enable authentication
jmail_props.put( "mail.smtp.auth", true);
//enable TLS
jmail_props.put( "mail.smtp.starttls.enable", "true");
Packages.javax.mail.Transport.send(html_msg, getSMTPUserName(), getSMTPPassword());
• If you are using non Java Mail API (the sendmail() function), you must ensure to use the correct user name that matches the one provided in the SMTP basic authentication. For example, you can use the function as eb.sendmail(username@domain.com, email, subject, message).