Skip to main content
Version: 1.28 (Current)

Send Email

Audience: Business Users

Skill 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​

Action NameDescription
Send Email (OAuth Compatible)Sends email through the site's DNN mail provider.
Load Users from SQLLoads several users so you can email all of them at once.
Load UserLoads a user so you can get recipient information from tokens.
Create List from SQLLoads recipients and other data from the database.
Create List from a CSV sourceLoads recipients and other data from CSV text.
Create List from Excel (.xlsx)Loads recipients and other data from an Excel file.
Create List from JSONLoads recipients and other data from JSON text.
Execute Actions for each List EntryRuns actions, such as this one, for each entry in a list.

Input Parameter Reference​

ParameterDescriptionSupports TokensDefaultRequired
ConnectorThe 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.YesDefault SMTPNo
FromThe sender's address, for example notifications@mydomain.com or Support Team <support@mydomain.com>. Leave empty to use the site's default email address.YesSite email addressNo
Determine Email AutomaticallyWhen checked and To is empty, the email is sent to the logged-in user.NoUncheckedNo
ToThe recipients, separated by ; or ,. Hidden when Determine Email Automatically or Send mail to all users is checked.Yesempty stringNo
Send mail to all usersWhen 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.NoUncheckedNo
Reply ToThe address replies should go to instead of From. Separate several addresses with commas. Semicolons aren't supported in this field.Yesempty stringNo
CCCarbon copy recipients, separated by ; or ,.Yesempty stringNo
BCCBlind carbon copy recipients, separated by ; or ,.Yesempty stringNo
SubjectThe subject line.Yesempty stringNo
FormatHow the body is sent. See Formats.NoHtml (And replace newline with <br />)No
DNN email template to useA predefined DNN email template. When selected, the template provides both the subject and the body, and the Body field is hidden.Nonone selectedNo
BodyThe email content.Yesempty stringNo
HeadersExtra email headers, as name and value pairs, for example X-Priority = 1. Values support tokens; names don't.YesemptyNo
Attach Portal FilesFiles from the portal to attach. Files from a different portal can't be attached.NoemptyNo
Attach Field #1 to #5Upload 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.Nonone selectedNo
Attach from TokenFiles 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.Yesempty stringNo
Ignore ErrorsWhen checked, errors don't stop execution. See How errors are handled.NoUncheckedNo
On ErrorActions to run if the email can't be built, for example because an address is invalid. See How errors are handled.NoemptyNo

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​

FormatDetails
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.
TextThe 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​

ConnectorMail server used
Empty or Default SMTPThe portal's SMTP settings, if the portal has its own SMTP server configured. Otherwise, the host SMTP settings.
Any other SMTP connectorThe 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.
  • CC and BCC are 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 Errors is checked.
  • If To also has an address, one more email is sent to it.

How errors are handled​

ErrorWhat happens
The email can't be built, for example an invalid address, no recipients, or no From addressThe 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 emailWith 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​

caution

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