About Send Mail test step
Use the Send Mail test step to send emails from your tests. If the step sends an email successfully, it passes. Otherwise, it fails.
Requirements
To use this test step, you need a ReadyAPI Test license. If you do not have it, you can request it on our web site or start a trial.
Editing Send Mail test step
You can modify settings of the test step in its editor:
Email subject
Message subject.
Message content
The body of the message.
Note: | You can use Property Expansions. |
Server
The address of the outgoing mail server. If you do not know the server’s address, ask your system administrator.
Port
The port of the outgoing mail server. Usually, port 25
is used. If you do not know the server’s port, ask your system administrator.
Login
Your account name used to connect to the outgoing mail server. Often, outgoing servers do not require authorization. Ask your system administrator if needed.
Password
Your account password used to connect to the outgoing mail server. Often, outgoing servers do not require authorization. Ask your system administrator, if needed.
To
A list of recipients’ email addresses. Use the semicolon to separate the addresses in the string.
From
The email address to which recipients will send the replies.
Timeout
Specifies how long ReadyAPI tries to connect to the specified server. Set to 0 to have no timeout.
Property list
Besides the test step editor, you can adjust test step behavior by using its properties in the SendMailRequestTestStep Properties and Custom Send Mail Request Test Step Properties panels in the Navigator.
SendMailRequestTestStep Properties | View ↓
Name | Description |
---|---|
Description |
Text describing the test step. |
Email subject |
The subject of the email. Corresponds to the Email subject option in the test step editor. |
From |
The email address to which recipients will send replies. Corresponds to the From option in the test step editor. |
Login |
Your account name used to connect to the outgoing mail server. Corresponds to the Login option in the test step editor. |
Message content |
The content of the message. Corresponds to the Message content option in the test step editor. |
Name |
The test step’s name. |
Password |
Your password used to connect to the outgoing mail server. Corresponds to the Password option in the test step editor. |
Port |
The port of the outgoing mail server. Corresponds to the Port option in the test step editor. |
Server |
The address of the outgoing mail server. Corresponds to the Server option in the test step editor. |
To |
The list of email recipients. Corresponds to the To option in the test step editor. |
Use STARTTLS command |
Sets whether ReadyAPI should use the STARTTLS command to set up a secured connection for sending an email. |
Name | Description |
---|---|
Name |
The test step’s name. |
Description |
Text describing the test step. |
Email subject |
The subject of the email. Corresponds to the Email subject option in the test step editor. |
Message content |
The content of the message. Corresponds to the Message content option in the test step editor. |
Server |
The address of the outgoing mail server. Corresponds to the Server option in the test step editor. |
Port |
The port of the outgoing mail server. Corresponds to the Port option in the test step editor. |
Login |
Your account name used to connect to the outgoing mail server. Corresponds to the Login option in the test step editor. |
Password |
Your password used to connect to the outgoing mail server. Corresponds to the Password option in the test step editor. |
To |
The list of email recipients. Corresponds to the To option in the test step editor. |
From |
The email address to which recipients will send replies. Corresponds to the From option in the test step editor. |
Use STARTTLS command |
Sets whether ReadyAPI should use the STARTTLS command to set up a secured connection for sending an email. |
Custom Send Mail Request Test Step Properties | View ↓
Values on the Custom Send Mail Request Test Step Properties tab are available to other test steps in your project. For instance, you can verify these property values with the Assertion test step, or check them and change the execution flow with the Conditional GoTo test step. To learn more, see About Properties.
You can modify custom properties, load their values from a file, or save them to a file. To do this, use the toolbar items.
This tab contains the following properties that provide access to the request and response data:
Name | Description |
---|---|
login |
Duplicates the Login property. Used to get its value by using the property expansion. |
mailFrom |
Duplicates the From property. Used to get its value by using the property expansion. |
mailTo |
Duplicates the To property. Used to get its value by using the property expansion. |
message |
Duplicates the Message content property. Used to get its value by using the property expansion. |
password |
Duplicates the Password property. Used to get its value by using the property expansion. |
port |
Duplicates the Port property. Used to get its value by using the property expansion. |
server |
Duplicates the Server property. Used to get its value by using the property expansion. |
StartTLSEnabled |
Duplicates the Use STARTTLS command property. Used to get its value by using the property expansion. |
subject |
Duplicates the E-Mail subject property. Used to get its value by using the property expansion. |
timeout |
Specifies how long ReadyAPI tries to connect to the specified server. Corresponds to the Timeout option in the test step editor. |
Name | Description |
---|---|
StartTLSEnabled |
Duplicates the Use STARTTLS command property. Used to get its value by using the property expansion. |
server |
Duplicates the Server property. Used to get its value by using the property expansion. |
password |
Duplicates the Password property. Used to get its value by using the property expansion. |
port |
Duplicates the Port property. Used to get its value by using the property expansion. |
subject |
Duplicates the E-Mail subject property. Used to get its value by using the property expansion. |
mailTo |
Duplicates the To property. Used to get its value by using the property expansion. |
message |
Duplicates the Message content property. Used to get its value by using the property expansion. |
login |
Duplicates the Login property. Used to get its value by using the property expansion. |
mailFrom |
Duplicates the From property. Used to get its value by using the property expansion. |
timeout |
Specifies how long ReadyAPI tries to connect to the specified server. Corresponds to the Timeout option in the test step editor. |
Logging
When the test step is run as part of a test case, you can see the test log in the Transaction Log panel.
Working with
Below, you can find information on common tasks that you can perform with the Send Mail test step.
Send Email via Gmail
One of the most popular email services is Gmail. This example shows how to configure the test step to send an email by using it.
-
If your account does not have 2-step verification, enable access to your account for less secure applications:
-
Go to https://accounts.google.com/DisplayUnlockCaptcha and log in to your Google account. It may ask you to pass a CAPTCHA test.
-
Go to the https://www.google.com/settings/security/lesssecureapps web page.
-
Enable the Access for less secure apps option.
-
-
If your account has 2-step verification, get an application password:
-
Go to the https://myaccount.google.com/apppasswords web page.
-
At the bottom, click Select app and select Other.
-
Specify the name of a password and click Generate.
-
-
In ReadyAPI, select the needed Send Mail test step and specify the following properties:
-
Server: smtp.gmail.com
-
Port: 587
-
Login: Your Gmail login
-
Password: Your Gmail password, or an app password if you use 2-step verification.
-
-
Specify the rest of settings according to your needs.
-
Set the Use STARTTLS command test step property to true.
-
Run the test step.
Make sure to disable the Access for less secure apps option after you finish sending the mail. This option makes your account potentially vulnerable.