Email Properties and Templates

abstract This section describes sending status emails during suite execution.
infoFor details about sending emails via a Sahi script, refer Sending Emails.

Email.properties file explained

Configuration file for javax.mail

If a value for an item is not provided, then system defaults will be used.

mail.smtp.starttls.enablebooleanIf true, enables the use of the STARTTLS command (if supported by the server) to switch the connection to a TLS-protected connection before issuing any login commands. Note that an appropriate trust store must configured so that the client will trust the server's certificate.
mail.hostStringThe server to connect to.
mail.portintThe server port to connect to.
mail.userStringDefault user name.
mail.passwordStringPassword. This is ignored if encrypted password is provided.
mail.encrypted.passwordStringEncrypted password. Salt for encryption is as per properties. If encrypted password is provided, mail.password is ignored.
mail.smtp.authbooleanIf true, attempt to authenticate the user using the AUTH command.
mail.isSSLbooleanIf true, uses SSL to connect and use the SSL port by default.
mail.fromStringEmail address of the sender
mail.toStringEmail address of the sender's To field. For multiple address separate by comma(,).
mail.ccStringEmail address of the sender's CC field, for multiple address separate by comma(,).
mail.bccStringEmail address of the sender's BCC field. for multiple address separate by comma(,).
mail.subject.prefixStringThe subject prefix for the email.

Sample properties file

mail.smtp.starttls.enable=true
mail.host=smtp.gmail.com
mail.port=25
mail.user=your_email@gmail.com
mail.password=your_password
#mail.encrypted.password=your_encrypted_password
mail.smtp.auth=true
mail.isSSL=false
mail.from=your_email@gmail.com
mail.to=recepient1@gmail.com,recepient2@gmail.com,recepient3@gmail.com
mail.cc=recepient4@gmail.com,recepient5@gmail.com
mail.bcc=recepient6@gmail.com,recepient7@gmail.com
mail.subject.prefix=my subject


Email template

Emails that get sent out at the end of a suite run, use a template. This template can be viewed from email_template.txt in the Configure UI.

The layout, format and content can be modified.

With regard to content, the following information can be added. With regard to subject, it can be provided at the top of email_template.txt like the following:
Subject : $STATUS - $SUITEINFO_SUITENAME - $SUITEINFO_HOST - $SUITEINFO_PORT


If subject is provided in email_template.txt then mail.subject.prefix property will not be prefixed for the mail. If subject is not provided in email_template.txt then default subject will be set in the mail.
warning email_template.xsl has been introduced from Sahi Pro 7.5.0. email_template.txt has been removed from the Configuration.

To provide subject in email_template.xsl, add the below mentioned code at line number 2 in email_template.xsl:
<!-- Subject : $STATUS - $SUITEINFO_SUITENAME - $SUITEINFO_HOST - $SUITEINFO_PORT -->