Send Email
Introduction
The Send Email activity allows you to send an email directly from a microflow. Within a single activity, you configure the following:
- Email server connection
- Authentication method
- Sender and recipients
- Message content
- Attachments
You can also test the connection and send a test email from Studio Pro while your app is running without having to trigger the microflow.
Each Send Email activity holds its own connection and message configuration. Connection settings are not shared automatically between activities. To reuse the same server settings across multiple activities, store them in Constants and reference those constants from each activity. See the Connection section below for more information.
Properties
Double-click the Send Email activity to open its dialog box. The dialog box is organized into the following tabs:
- General – configure the sender, the security method, and the server connection
- Message – configure the recipients, custom headers, message body, and attachment
- Test Email – send a test email to verify your configuration
General Tab
The General tab configures how Studio Pro connects and authenticates to the email (SMTP) server, and which address the email is sent from.
Sender's Details
Email ID (From)
The From address is the email address the email is sent from. You can type a value directly, or click Edit to define the value using a microflow expression.
Security Method
The Security method section determines how the connection authenticates to the email server. The connection uses basic authentication.
Basic authentication (username and password) is deprecated or disabled by default on several major email providers, including Google Workspace and Microsoft 365, unless the tenant administrator has explicitly re-enabled it. To send emails through these providers, you can:
- Re-enable SMTP basic authentication for the account (where your administrator's policy allows it), or
- Use a provider that supports basic SMTP authentication.
Username
The Username property is the username used to authenticate to the email server.
Password
The Password property is the password used to authenticate to the email server.
Connection
The Connection field configures how Studio Pro reaches the email server.
Email Protocol
The Email Protocol property is the protocol used to send email. This property is read-only.
Default value: SMTP
Security Type
The Security Type property is the transport security used for the connection: None, SSL, or TLS.
Default value: TLS
Check Server Identity
The Check Server Identity option defines whether to verify the server's identity (certificate). This option is only enabled when Security Type is set to SSL.
Default value: No
Timeout (ms)
The connection timeout (in milliseconds).
Default value: 20000
Server Host
The Server Host property is the address of the email (SMTP) server.
Server Port
The Server Port property is the port of the email (SMTP) server.
Test Connection
Click Test Connection to verify the configured connection and authentication settings are valid.
Message Tab
The Message tab configures the recipients, custom headers, message content, and attachment.
Receiver's Details
Configure the recipients in the table by selecting a row and clicking Edit (or double-clicking the row). Each value is defined using a microflow expression.
To
The To field is the primary recipient (or recipients) of the email.
Cc
The Cc field is the carbon-copy recipient (or recipients) of the email.
Bcc
The Bcc field is the blind carbon-copy recipient (or recipients) of the email.
Custom Headers
The Custom headers section allows you to add custom email headers. Use the toolbar to manage headers:
- Add – add a new custom header
- Edit – edit the selected custom header
- Delete – remove the selected custom header
Name
The Name property is the name of the header. This can only contain letters, digits, and hyphens, and cannot be empty.
Value
The Value property is the value of the header. It cannot be empty or contain line breaks.
Message Body
The following fields can be defined either as plain text or as a string template. A string template is fixed text with {1}, {2}, … placeholders whose values are of type microflow expression and come from parameter expressions evaluated against the surrounding microflow. For example:
Subject: "Order {1} confirmed"
{1} → $Order/OrderNumber
Body: "Hi {1}, your order ships on {2}."
{1} → $Order/Customer/FirstName
{2} → formatDateTime($Order/ShipDate, 'yyyy-MM-dd')Consider the following about templates:
- The subject, the plain-text body, and the HTML body each have their own template. For a given field, use either the plain value or its template consistently.
- Keep placeholder numbering contiguous (
{1},{2}, …), and make sure every placeholder has a corresponding parameter expression. - Only reference variables that exist in the microflow's scope at the activity's position. If the data is not yet available, retrieve it earlier in the flow.
- The HTML and plain-text bodies are independent. Populate only the one (or ones) you need.
Subject
The Subject property is the subject line of the email.
Message Body (Plain Text)
The Message Body (Plain Text) property is the plain-text version of the email body.
Message Body (HTML)
The Message Body (HTML) property is the HTML version of the email body.
Attachment
In the Attachment section, select a microflow variable to attach to the email.
Variable
Only variables of type System.FileDocument, List of System.FileDocument, or their specializations can be attached. The variable must exist in the microflow's scope before the Send Email activity (the file must already have been retrieved or created earlier in the flow).
Test Email Tab
The Test Email tab allows you to send a test email to verify your configuration from Studio Pro without triggering the microflow.
Test Email Details
Use Template for Test Email
When Use Template for Test Email is selected, the subject and body fields use the string templates configured on the Message tab. Because template placeholders reference microflow variables that are not available while testing, click the Edit icon next to each field to provide test values for the template parameters.
When not selected, you can enter the subject and body directly.
To
The To property is the recipient of the test email.
Subject
The Subject property is the subject line of the test email.
Message Body (Plain Text)
The Message Body (Plain Text) property is the plain-text version of the test email body.
Message Body (HTML)
The Message Body (HTML) property is the HTML version of the test email body.
Send Test Email
Click Send Test Email to send the test email using the current configuration. A message indicates whether the test email was sent successfully.
Error Handling
Sending emails can fail at runtime for reasons outside your app's control, such as:
- The email server is unreachable
- The connection times out
- Authentication is rejected
- A recipient address is invalid
When this happens, the Send Email activity raises and logs an error.
Handle these failures by configuring an error handler on the activity. This lets you, for example, log the failure, notify the user, or retry through an alternative path instead of letting the whole microflow fail. Because email delivery depends on external systems, wrapping the Send Email activity in error handling is strongly recommended for production apps.
Before Going to Production
Review the following before you deploy to a production app.
Authentication and Credentials
- This version of the activity supports basic authentication (username and password) only. Confirm your email provider permits SMTP basic authentication (Google Workspace and Microsoft 365 disable it by default) or use a provider that does.
- Do not hard-code credentials in the microflow model. Supply them through per-environment constants so secrets (the password in particular) are not stored in the app model or version control.
Email Deliverability (SPF, DKIM, and DMARC)
The sending domain must be configured correctly at the DNS level for your emails to be accepted and not marked as spam.
- SPF – authorizes which servers may send emails for your domain
- DKIM – cryptographically signs your messages so recipients can verify they were not altered
- DMARC – tells receiving servers how to handle messages that fail SPF or DKIM checks
If these records are missing or misconfigured, receiving servers may reject your messages or route them to spam, even when the activity reports that the email was sent successfully. Set these up with your email provider and domain administrator before going live.
Read More
- Sending Email – external email providers and SMTP configuration for Mendix Cloud
- Error Handling in Microflows
- Constants
- Microflow Expressions