Aller au contenu principal

Send & Receive Mail Steps

The Send Mail and Receive Mail steps integrate email into test automation — useful for account verification, password reset and notification workflows.

When to Use​

  • Testing email-based flows: verification codes, password resets, notifications.
  • Asserting that a system sent the expected message to a mailbox.
  • Extracting a link or code from an email to drive the next step.

Why: Email is often the only observable side-effect of a workflow (a verification link, a reset token). These steps let you drive and assert that channel like any other.

Send Mail Step​

Display name: Send Mail (SMTP). Sends an email over SMTP.

Configuration (SMTP Settings tab)​

FieldDescription
Server AddressSMTP host (default smtp.yourprovider.xyz). Supports ${VariableName}.
PortSMTP port (default 587).
SSLUse SSL/TLS (true by default).
STARTTLSUse STARTTLS (true by default).
UsernameSMTP authentication username.
PasswordSMTP password — stored encrypted; use ${VariableName} for secrets.
Server ResponseRead-only response returned by the server.

A Connection Profile picker (type Smtp) can supply all of the above; when active, the inline fields are hidden. Two further tabs are available:

  • MIME Message — the MailMessage editor (MimeMessageEditor).
  • Raw Message — read-only rendered raw message.

Attachments are configured as a list of file names (relative, resolved from the project files/ folder); ${VariableName} substitution is supported on each entry. Missing files are logged as diagnostics and skipped.

remarque

The MIME message and attachments are combined at send time. The step returns RunResult.Success on a successful SmtpClient.Send, otherwise RunResult.Failure.

Receive Mail Step​

Display name: Receive Mail. Connects to a mailbox over IMAP or POP3 and selects matching messages.

Configuration (Server Configuration tab)​

FieldDescription
ProtocolIMAP (default) or POP3.
Server AddressIMAP/POP3 host (e.g. imap.yourserver.com). Supports ${VariableName}.
PortServer port (default 993).
SSL/TLSEnable TLS (true by default).
STARTTLSEnable STARTTLS (false by default).
UsernameMailbox username. Supports ${VariableName}.
PasswordMailbox password (or app password). Stored encrypted.

A Connection Profile picker (type MailInbox) can supply the protocol, server, port, TLS options and credentials; when active the inline fields are hidden.

Configuration (Mail filter tab)​

The Filters expander contains:

FieldDescription
Subject FilterSelects mail by subject; supports ${VariableName}.
Filtering ModeAn Action (compare action: AreEqual, Contains, GreaterThan, …) and a Mode (compare mode: Binary, CaseInsensitive, Loose, RegularExpression, RegularExpressionIgnoreCase, NodeExists, NodeNotExists).
Time FilterOnly select mail received within this TimeSpan.
LimitMaximum number of recent mails to check (default 10).
Wait TimeoutMaximum time to wait for a matching mail (default 2 minutes). The step re-checks every 15 seconds until a match or the timeout.

Matched messages are listed in the Retrived Messages grid (Action / Subject / From / Date) with an Open button. Selected messages are available in MimeMessages.

remarque

If no mail matches the subject filter before the wait timeout, the step returns RunResult.Failure with "No Email matchs the Subject filter. Test failed."

Common Pattern: Email Verification Flow​

Step 1: Send Request (POST /register) → stores ${VerificationCode}
Step 2: Wait (00:00:05) — wait for email delivery
Step 3: Receive Mail
Protocol: IMAP
Subject Filter: "Verify your account" (Mode: Contains)
→ matched messages in MimeMessages
Step 4: C# Script — extract verification link from the message
Step 5: Send Request (GET <link>)
Step 6: Assert (Status Code = 200)

See Also​