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 email template file email_template.xsl is present in the <Sahi_Installation>/config directory.

The layout, format and content of this template can be modified. To add modifications, copy the email template file email_template.xsl to <Sahi_Installation>/userdata/config directory. Now make changes as necessary to this copied file.

With regard to content, the following information can be added. To provide a subject in the email template, add the below mentioned code at line number 2 in <Sahi_Installation>/config/email_template.xsl.
<!-- Subject : $STATUS - $SUITEINFO_SUITENAME - $SUITEINFO_HOST - $SUITEINFO_PORT -->


If a subject is provided in email_template.xsl then mail.subject.prefix property will not be prefixed for the mail. If a subject is not provided in email_template.xsl then the default subject will be set in the mail.
warning Email template file email_template.xsl is available since Sahi Pro v7.5.0. For versions prior to Sahi Pro v7.5.0, use email_template.txt. Refer here for details.