Send Email
Audience:
Business UsersSkill Prerequisites:
HTML,Tokens
Sends an email to one or more recipients, with optional attachments. The email is sent through the site's SMTP settings, or through an SMTP connector you choose. Tokens can be used in the addresses, subject and body, so each email can be personalized.
Typical Use Cases
- Send notifications, for example to an administrator when a form is submitted
- Send confirmation emails to users
- Send a personalized email to each user in a group
- Send generated documents, such as PDFs, as attachments
Don't use it to
- Debug. Use Log Error or Log Debug Message instead.
- Send through the site's DNN mail provider, for example an OAuth mail provider. Use Send Email (OAuth Compatible) instead.
Related Actions
| Action Name | Description |
|---|---|
| Send Email (OAuth Compatible) | Sends email through the site's DNN mail provider. |
| Load Users from SQL | Loads several users so you can email all of them at once. |
| Load User | Loads a user so you can get recipient information from tokens. |
| Create List from SQL | Loads recipients and other data from the database. |
| Create List from a CSV source | Loads recipients and other data from CSV text. |
| Create List from Excel (.xlsx) | Loads recipients and other data from an Excel file. |
| Create List from JSON | Loads recipients and other data from JSON text. |
| Execute Actions for each List Entry | Runs actions, such as this one, for each entry in a list. |
Input Parameter Reference
| Parameter | Description | Supports Tokens | Default | Required |
|---|---|---|---|---|
| Connector | The SMTP connector to send through. Leave empty, or choose Default SMTP, to use the site's SMTP settings. See How the mail server is chosen. | Yes | Default SMTP | No |
| From | The sender's address, for example notifications@mydomain.com or Support Team <support@mydomain.com>. Leave empty to use the site's default email address. | Yes | Site email address | No |
| Determine Email Automatically | When checked and To is empty, the email is sent to the logged-in user. | No | Unchecked | No |
| To | The recipients, separated by ; or ,. Hidden when Determine Email Automatically or Send mail to all users is checked. | Yes | empty string | No |
| Send mail to all users | When checked, a separate email is sent to each user loaded in the context, for example by Load Users from SQL. See Sending to all users. | No | Unchecked | No |
| Reply To | The address replies should go to instead of From. Separate several addresses with commas. Semicolons aren't supported in this field. | Yes | empty string | No |
| CC | Carbon copy recipients, separated by ; or ,. | Yes | empty string | No |
| BCC | Blind carbon copy recipients, separated by ; or ,. | Yes | empty string | No |
| Subject | The subject line. | Yes | empty string | No |
| Format | How the body is sent. See Formats. | No | Html (And replace newline with <br />) | No |
| DNN email template to use | A predefined DNN email template. When selected, the template provides both the subject and the body, and the Body field is hidden. | No | none selected | No |
| Body | The email content. | Yes | empty string | No |
| Headers | Extra email headers, as name and value pairs, for example X-Priority = 1. Values support tokens; names don't. | Yes | empty | No |
| Attach Portal Files | Files from the portal to attach. Files from a different portal can't be attached. | No | empty | No |
| Attach Field #1 to #5 | Upload fields whose files are attached. Available in forms and grids. Field #3 accepts single file upload fields only; the others accept single and multi file upload fields. | No | none selected | No |
| Attach from Token | Files to attach, separated by ; or ,. Each can be a file ID, a path relative to the portal root, a path that includes the portal folder (Portals/0/...) or a URL of a file on the site. Files that can't be found are skipped without an error. | Yes | empty string | No |
| Ignore Errors | When checked, errors don't stop execution. See How errors are handled. | No | Unchecked | No |
| On Error | Actions to run if the email can't be built, for example because an address is invalid. See How errors are handled. | No | empty | No |
Every email needs at least one address in To, CC or BCC, otherwise the action fails with Mail cannot be sent. You must provide at least one destination email (To, CC or BCC).
Output Parameters Reference
This action doesn't create output tokens. When On Error runs, the [Exception], [ExceptionType], [ExceptionMessage] and [ExceptionStack] tokens describe the error.
Formats
| Format | Details |
|---|---|
Html (And replace newline with <br />) | Line breaks in Body are turned into <br /> tags, which makes simple emails easier to type. Some email programs, such as Outlook, may display the result oddly. |
| Html (Recommended) | The body is sent as HTML exactly as written. What you see in the Body editor is what recipients see. In JSON, its value is HtmlWithoutNewline. |
| Text | The body is sent as plain text. HTML tags are removed. |
For the HTML formats, a plain-text version of the email is created automatically for email programs that don't display HTML.
How the mail server is chosen
| Connector | Mail server used |
|---|---|
| Empty or Default SMTP | The portal's SMTP settings, if the portal has its own SMTP server configured. Otherwise, the host SMTP settings. |
| Any other SMTP connector | The server, port, credentials, SSL and authentication settings saved in the connector. See Connectors. |
The Connector parameter is available on Plant an App sites. Sending times out after 60 seconds.
If From is empty, the sender is the host email address on Plant an App sites, or the portal's email address on other sites. If no address is found, the action fails with 'From' email could not be found!
Sending to all users
When Send mail to all users is checked:
- A separate email is sent to each user loaded in the context. Users without an email address are skipped.
[User:...]tokens, such as[User:FirstName], refer to the user each email is sent to.CCandBCCare added to every email, so CC recipients get one copy per user.- If some emails fail, the others are still sent, and the action then fails with Failed to send emails unless
Ignore Errorsis checked. - If
Toalso has an address, one more email is sent to it.
How errors are handled
| Error | What happens |
|---|---|
The email can't be built, for example an invalid address, no recipients, or no From address | The error tokens are set and On Error runs. If On Error ends execution, for example with a message, that's the result. Otherwise, with Ignore Errors checked execution continues; unchecked, an error is shown. |
| The mail server rejects or can't receive the email | With Ignore Errors checked, the failure is ignored and On Error doesn't run. Unchecked, the action fails with Could not send email from ... to .... |
Security
To, From, CC, BCC and Reply To support tokens. If their values come from an untrusted source, the recipients can be changed.
For example, if users type an email address into a form, they could enter my-email@company.com;other-email@othercompany.com and have an email meant only for them sent to someone else. Use tokens such as [User:Email], or fixed addresses, for recipients whenever you can.
Examples
The FROM parameter needs to be in concordance with the application SMTP settings. (eg: notifications@mydomain.com).
For Plant An App cloud-hosted application, the From address can be anything@my-app.apps.plantanapp.com or an address from a custom domain, if configured.
1. Simple Email
Send a simple email
{
"Title": "Send Email",
"ActionType": "SendMail",
"Description": "Simple example, confirmation email",
"Condition": null,
"Parameters": {
"From": "support@plantanapp.com",
"DetermineEmail": "",
"To": "support@plantanapp.com",
"ToAllUsers": "",
"ReplyTo": "",
"Cc": "",
"Bcc": "",
"Subject": "Confirmation email",
"Format": {
"Expression": "",
"Value": "Html",
"IsExpression": false,
"Parameters": {}
},
"DnnEmailTemplate": {
"Expression": "",
"Value": "",
"IsExpression": false,
"Parameters": {}
},
"Body": "<p>Dear Customer,</p><p>Thank you for choosing us.</p>",
"Headers": "",
"PortalFiles": "",
"FileField1": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileField2": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileField3": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileField4": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileField5": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileToken1": "/Portals/0/Images/logo.png",
"IgnoreErros": ""
}
}
2. Simple Email with Tokens
In this simple example, we use tokens to send the email from the current user to itself. This is done using the [User:Email] token. We also use the [User:FirstName] and the [User:LastName] tokens to create a dynamic email body.
{
"Title": "Send Email",
"ActionType": "SendMail",
"Description": "Example using tokens",
"Condition": null,
"Parameters": {
"From": "[User:Email]",
"DetermineEmail": "",
"To": "[User:Email]",
"ToAllUsers": "",
"ReplyTo": "",
"Cc": "",
"Bcc": "",
"Subject": "",
"Format": {
"Expression": "",
"Value": "Html",
"IsExpression": false,
"Parameters": {}
},
"DnnEmailTemplate": {
"Expression": "",
"Value": "",
"IsExpression": false,
"Parameters": {}
},
"Body": "<p>Dear [User:FirstName] [User:LastName],</p><p>This is an example email that is using tokens.</p>",
"Headers": "",
"PortalFiles": "",
"FileField1": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileField2": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileField3": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileField4": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileField5": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileToken1": "",
"IgnoreErros": ""
}
}
3. A more complex setup for sending an email
In this example, we demonstrate how to use a mix of text and tokens to set parameters.
Note how the From parameter can be configured to also have a display name, such as The Sender of the Email<support@plantanapp.com>. Same applies to any email field.
In addition, we set up a token for the logo so we can send it with the email as an attachment.
{
"Title": "Execute Actions",
"ActionType": "ExecuteActions",
"Description": "A more complex setup for sending an email",
"Condition": null,
"Parameters": {
"ActionList": [
{
"Id": -1,
"$_uid": "action15918762609049277",
"Parameters": {
"Data": [
{
"value": "/Images/logo.png",
"name": "Path"
}
]
},
"ActionType": "InjectData",
"$_isOpen": false,
"$_isLoaded": true,
"$_isFocus": true,
"Definition": {
"IsClientAction": false,
"Settings": {
"Group": "Context"
}
}
},
{
"Title": "Send Email",
"ActionType": "SendMail",
"Description": "Complex example",
"Condition": null,
"Parameters": {
"From": "The Sender of the Email<support@plantanapp.com>",
"DetermineEmail": "",
"To": "user1@plantanapp.com; user2@plantanapp.com; [User:Email]",
"ToAllUsers": "",
"ReplyTo": "",
"Cc": "user3@plantanapp.com; user4@plantanapp.com;",
"Bcc": "user5@plantanapp.com; user6@plantanapp.com;",
"Subject": "Multiple emails sent",
"Format": {
"Expression": "",
"Value": "Html",
"IsExpression": false,
"Parameters": {}
},
"DnnEmailTemplate": {
"Expression": "",
"Value": "",
"IsExpression": false,
"Parameters": {}
},
"Body": "<p>Dear Customers,</p><p>This is an example using tokens. The email was sent to: user1@plantanapp.com; user2@plantanapp.com; [User:Email]</p>",
"Headers": "",
"PortalFiles": "",
"FileField1": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileField2": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileField3": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileField4": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileField5": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileToken1": "[Path]",
"IgnoreErros": ""
},
"$_uid": "action15918762609042327",
"$_isOpen": false,
"$_isLoaded": true,
"$_isFocus": true
}
]
}
}
4. Send an email to a list of recipients retrieved from the database
In this example, we will load all the existing users directly from the database and send them an email. Note that we are using the Send mail to all users parameter instead of setting the To parameter.
{
"Title": "Execute Actions",
"ActionType": "ExecuteActions",
"Description": "Send email to all users loaded into the context",
"Condition": null,
"Parameters": {
"ActionList": [
{
"Id": -1,
"$_uid": "action15918764465462106",
"Parameters": {
"SqlQuery": "SELECT UserId from Users"
},
"ActionType": "LoadUsersFromSql",
"$_isOpen": false,
"$_isLoaded": true,
"$_isFocus": true,
"Definition": {
"IsClientAction": false,
"Settings": {
"Group": "Context"
}
},
"IsDeleted": false,
"Description": "Get all the users in the system"
},
{
"Id": -1,
"$_uid": "action15918764465464449",
"Parameters": {
"From": "support@plantanapp.com",
"DetermineEmail": "",
"To": "",
"ToAllUsers": true,
"ReplyTo": "",
"Cc": "",
"Bcc": "",
"Subject": "Example",
"Format": {
"Expression": "",
"Value": "Html",
"IsExpression": false,
"Parameters": {}
},
"DnnEmailTemplate": {
"Expression": "",
"Value": "",
"IsExpression": false,
"Parameters": {}
},
"Body": "<p>Dear Customers,</p><p>This is an example.</p>",
"Headers": "",
"PortalFiles": "",
"FileField1": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileField2": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileField3": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileField4": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileField5": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileToken1": "",
"IgnoreErros": ""
},
"ActionType": "SendMail",
"$_isOpen": false,
"$_isLoaded": true,
"$_isFocus": true,
"Definition": {
"IsClientAction": false,
"Settings": {
"Group": "Email"
}
},
"Description": "Send email to all users loaded into the context"
}
]
}
}
5. Send email to a list of entities loaded from the database
{
"Title": "Execute Actions",
"ActionType": "ExecuteActions",
"Description": "Send email to a list of entities loaded from the database",
"Condition": null,
"Parameters": {
"ActionList": [
{
"Id": -1,
"$_uid": "action15918774716255219",
"Parameters": {
"ConnectionString": "",
"SqlQuery": "select Firstname, Lastname, Email, CreatedOnDate, Username from Users",
"BindTokens": "",
"EntityName": "UserDetails",
"EntityProps": [],
"OnError": []
},
"ActionType": "LoadEntitiesFromSql",
"$_isOpen": false,
"$_isLoaded": true,
"$_isFocus": true,
"Definition": {
"IsClientAction": false,
"Settings": {
"Group": "Entities"
}
},
"Description": "Load Email List"
},
{
"Id": -1,
"$_uid": "action15918774716251116",
"Parameters": {
"EntityName": "UserDetails",
"Filters": "",
"ContextBehavior": {
"Expression": "",
"Value": "",
"IsExpression": false,
"Parameters": {}
},
"ActionList": [
{
"Id": -1,
"$_uid": "action15918774102278206",
"Parameters": {
"From": "support@plantanapp.com",
"DetermineEmail": "",
"To": "[UserDetails:Email]",
"ToAllUsers": "",
"ReplyTo": "",
"Cc": "",
"Bcc": "",
"Subject": "Created date for [UserDetails:Username]",
"Format": {
"Expression": "",
"Value": "Html",
"IsExpression": false,
"Parameters": {}
},
"DnnEmailTemplate": {
"Expression": "",
"Value": "",
"IsExpression": false,
"Parameters": {}
},
"Body": "<p>The user: [UserDetails:Firstname] [UserDetails:Lastname] was created on date [UserDetails:CreatedOnDate]</p>",
"Headers": "",
"PortalFiles": "",
"FileField1": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileField2": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileField3": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileField4": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileField5": {
"Expression": "",
"Value": "",
"IsExpression": false
},
"FileToken1": "",
"IgnoreErros": ""
},
"ActionType": "SendMail",
"$_isOpen": false,
"$_isLoaded": true,
"$_isFocus": true,
"Definition": {
"IsClientAction": false,
"Settings": {
"Group": "Email"
}
}
}
],
"ContinueOnError": "",
"OnError": []
},
"ActionType": "ExecuteActionsOnEntityList",
"$_isOpen": false,
"$_isLoaded": true,
"$_isFocus": true,
"Definition": {
"IsClientAction": false,
"Settings": {
"Group": "Entities"
}
},
"Description": "Send email for each entity"
}
]
}
}
Revised 09/25/2026