Nexial Automation

Test Automation Platform for everyone!

X

mail

The “mail” command type represents the automation command regarding sending emails. Future enhancement could include the retrieval of emails as well (if you need this feature sooner, submit an issue to increase the priority thereof).

In order to send email, appropriate mail server connectivity must be defined first. The section below describes how mail server connectivity would be configured.

The mail commands represent a series of automation regarding emails (SMTP). As of now, the main focus is on sending email. Future version of Nexial could potentially support the reading email as well. If this is of interest or importance to you, please let us know via the GitHub Feature request form. It’ll help us prioritize future Nexial features.

Using the mail commands, one can configure the configuration of an outgoing email dynamically, including:

In order to send email, appropriate mail server connectivity must be defined first. The section below describes how mail server connectivity would be configured.

It is noteworthy to clarify that the mail server connectivity used here may not necessarily be the same as that used by Nexial to send out email notification.

Mail Settings

The mail command type uses a “profile” to group related data variables together, much like the case for ssh, rdbms or aws.s3. The profile-based connectivity setting can be defined via command line (i.e. JAVA_OPT=-D... or via the -override option), project.properties, or the appropriate data file. Below is a command line example:

nexial.sh -plan ... ... -override MyMail.from=boss@mystore.com -override MyMail.host=mail.mystore.com -override MyMail.port=25

Here are the various settings available to configure the appropriate mail server for your automation (assuming profile is MyEmail):

data variable description
MyEmail.host [REQUIRED] the SMTP host for nexial
MyEmail.port [REQUIRED] the SMTP port for nexial; default is 25
MyEmail.username [optional] auth user for SMTP host. Required only if auth is true
MyEmail.password [optional] auth credential for SMTP host. Required only if auth is true
MyEmail.tls [optional] boolean; determine if TTLS is enable for SMTP
MyEmail.localhost [optional] determine if SMTP service is locally available
MyEmail.from [REQUIRED] the sender of mail sent via nexial
MyEmail.protocol [REQUIRED] smtp or imap; default is smtp
MyEmail.auth [optional] whether authentication is required to send mail; default is false
MyEmail.bufferSize [optional] buffer size for smtp packet; default to system default of 512
MyEmail.contentType [optional] smtp MIME type to use; default is text/html


Gmail

*(!!! IMPORTANT !!!) Note that as of May 30th, 2022, Google has announced that it will no longer support SMTP protocol issued via a third-party application (such as Nexial).

However, if you are using a Gmail account provisioned through a paid Google Workspace or Google Cloud account, sending email via Gmail (SMTP) is still possible with a few initial steps.

Here’s the settings for targeting Gmail as the mail host:

Note that you need to fill in the correct email and password for Gmail.username and Gmail.password. You can optionally rename the profile from Gmail to something else.

Gmail by default enforces “secured third-party client app” such that programmatically access (such as Nexial does) is denied. You might see a similar error as below when running a mail command against Gmail:

This is an indication that the email account in questionis restricted to “secured third-party client app” only. For further understanding about this, please visit https://support.google.com/mail/answer/7126229?visit_id=1-636610148744612821-503885497&rd=2#cantsignin and https://support.google.com/accounts/answer/6010255.

This issue can be addressed via https://myaccount.google.com/lesssecureapps. After successfully signing in to your Gmail account, proceed to enable “les secure apps” option:

After this, you should be able to send email via your Gmail account. For security reason, it is recommended NOT to use your personal account for automation. Instead, set up another Gmail account for the purpose of automating the sending of emails via Nexial.

Available Commands