This article explains commands available to work with email retrieval, sending, and validation in your automation testing. You can build comprehensive logic involving Email validation from the Logic Editor using this set of commands.
ACCELQ allows you to define filters based on various criteria, to help retrieve the target email across your email repository. These filters can be used in any command that requires finding an email.
Define Connection
Note: If you are using OAuth 2.0 (mandatory for Gmail and Outlook email), make sure to complete the prerequisites:
Defines the connection parameters for the email server (SMTP) with a given reference name. This reference name is used in subsequent commands for retrieval or verification of emails. If your test logic requires working with multiple SMTP servers, you can create multiple connections with different reference names, and switch between them based on your requirement.
Incoming server details are required for email retrieval commands (for download and delete operations). You can either provide POP3 or IMAP server configuration for the Incoming server. If you are using POP3, only INBOX folder is supported.
Outgoing server (SMTP) details are required for sending mail through your Action logic. Be sure to provide correct port numbers depending on the type of server and encryption type such as TLS (Transport Layer Security) or SSL (Secure Sockets Layer).
session reference name |
session reference name |
Note: Password (in the configuration parameters above) needs to be supplied only if you need to read emails as part of your test logic. If all you need is to send emails from your test logic, you do not need to furnish the password.
Note: Password is encrypted inline while you type in the Logic Editor, and does not show up in plain text in the statement.
Send Email
Sends an email to specified recipients on the currently active email service session. When multiple recipients, CC, and BCC recipients are present, separate the mail ids with a comma (,).
You can also specify files to be attached to the email. Multiple attachments can be separated with a comma (,). The filename can be either an absolute path available during test execution or a path relative to the agent's user files folder.
Make sure to provide outgoing mail server (SMTP) details while defining mail connection.
To emails (recipients) |
comma ( , ) separated recipients |
Switch to Email Session
When you are working with multiple email server connections simultaneously, this command can be used to switch between different server sessions. Make sure the session is already defined with the specified session name.
session ref name |
session name to be switched to |
Retrieving mail information
Define Email Filter
A filter defines criteria to use when retrieving emails for reading/verification purposes. For example, you can set up a filter based on a Sender, Subject, dates, etc. Once defined, this filter can be used in other Email commands. You can define multiple filters and use them while retrieving emails.
filter ref name |
reference name for this filter |
Get Email Count
Returns mail count from given mail folder (default mail folder is "INBOX") in current email session. You can also pass the reference name of a pre-defined filter to base the count on. Returns -1 on error.
mail folder name |
mail folder name (leave it blank to use "INBOX") |
Get Mail Information
Returns information about an email, which is identified based on specified criteria. You can specify the email folder name (default is INBOX) and/or an existing filter that you created to retrieve the list of matching emails. From the list of emails matching the criterion, you can then specify the ordinal index to indicate which specific email you are interested (the most recent email is indicated with index: 1).
mail info type |
mail information to return. SUBJECT, BODY, FROM, TO, CC, BCC, SENT_DATE, RECEIVED_DATE |
Get Email Folder Names
Returns mail folder names separated by a given delimiter.
Delimiter |
Delimiter to separate folder names |
Get Hyperlink from Email Body
Returns the hyperlink from the email body at a specified ordinal index.
mail folder name |
mail folder name |
Download Email attachments
Downloads attachments of an email. Specific email is identified by a combination of the Folder name, Filter name, and ordinal index. Email ordinal index starts from 1 and indicates the latest email.
If the download folder/directory does not exist, it is created as part of the execution of this command.
mail folder name |
mail folder name |
Email data verification
Verify Email count
Verifies mail count from given mail folder (default mail folder is "INBOX") in current email session. Optionally, a filter can also be applied with a filter reference name to get the count for a specific criterion.
mail folder name |
mail folder name |
Verify Email information
This command can be used to verify information in an email, that includes Body, Subject, Sender, Receiver, date, etc. Target email can be identified by a combination of factors such as the email folder name (default is INBOX), pre-defined filter name, and the index of the matching email.
mail info type
|
mail information type i.e SUBJECT, BODY, FROM, TO, CC, BCC, SENT_DATE, RECEIVED_DATE
|
Here is an example:
- Define the connection parameters for the email server (SMTP) with a reference name.
- Define email filter based on specified criteria with a reference name.
- Get email information based on specified criteria and store it in local parameter, email information
- Extract the information after a specified text 'verification code' from a specified string to get the verification code and store it in a local parameter, Verification Code
- Extract the verification code from the above local parameter, email information, at the first ordinal index and store it in a local parameter, Verification Code.
Comments
0 comments
Article is closed for comments.