Skip to content
Get Free Trial

Email Properties and Templates

This section describes sending status emails during suite execution.

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

Property Type Description
mail.smtp.starttls.enable boolean If 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.smtp.ssl.protocols String This property is a configuration setting used in JavaMail to specify the SSL/TLS protocols enabled for secure SMTP connections.
mail.host String The server to connect to.
mail.port int The server port to connect to.
mail.user String Default user name.
mail.password String Password. This is ignored if encrypted password is provided.
mail.encrypted.password String Encrypted password. Salt for encryption is as per properties. If encrypted password is provided, mail.password is ignored.
mail.smtp.auth boolean If true, attempt to authenticate the user using the AUTH command.
mail.isSSL boolean If true, uses SSL to connect and use the SSL port by default.
mail.from String Email address of the sender
mail.to String Email address of the sender’s To field. For multiple address separate by comma(,).
mail.cc String Email address of the sender’s CC field, for multiple address separate by comma(,).
mail.bcc String Email address of the sender’s BCC field. for multiple address separate by comma(,).
mail.subject.prefix String The subject prefix for the email.
mail.smtp.starttls.enable=true
mail.smtp.ssl.protocols=TLSv1.2
mail.host=smtp.gmail.com
mail.port=587
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

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.

  • Value of any column in SUITEREPORTS table that is not already present in the template can be added using $COLUMNNAME, for example: $SUITEPATH

  • The SUITEINFO column contains a bunch of information as key-value pairs. This information can be viewed under the Suite Info section in the Suite Report log. A value can be added using $SUITEINFO_KEY. For example, the BaseUrl can be added using $SUITEINFO_BASEURL. If custom fields were specified for the suite, they will be available in SUITEINFO so they can be added to the email template as well. For example, if a custom field “RELEASEID” was specified while running the suite, its value can be added in the email template using $SUITEINFO_RELEASEID

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.