Skip to main content
Version: 1.25

Send Email

Audience: Business Users

Skill Prerequisites: HTML

This action sends an email to one or multiple recipients. It also supports sending attachments along with the body of the email. The content of the email can be configured for each recipient when sending to multiple addresses.

Typical Use Cases

  • Send email notifications

  • Send confirmation emails

  • Newsletters

  • Email Campaigns with the help of our BeeFree integration

Don't use it to

  • Debug - Use Log Error or Log Debug Message
Action NameDescription
Load Users from SQLLoad multiple users so you can send emails to all of them at once
Create List from CSV file (obsolete)Load emails and other data from a CSV file to compose complex emails
Create List from a CSV sourceLoad emails and other data from a CSV formatted text to compose complex emails
Create List from Excel (xlsx)Load emails and other data from an Excel file to compose complex emails
Create List from JSONLoad emails and other data from a JSON formatted text to compose complex emails
Create List from SQLLoad emails and other data from the database to compose complex emails
Load UserLoad an user so you can obtain recipient information via tokens
Execute Actions for each List EntryExecute a set of actions for each entity, that can help you to compose complex emails

Input Parameter Reference

ParameterDescriptionSupports TokensDefaultRequired
FromThe email address from which the email(s) will be sentYesCreator of the websiteNo
ToRecipient(s) to send the email to. Multiple Recipients can be separated by semicolon (;)Yesempty stringYes
Send email to all usersSends emails to all users in the context loaded by Load Users from SQLNoNoNo
Reply ToEmail address that the reply message is sent back to instead of the From address. Multiple recipients can be separated by a semicolon (;) or a comma(,)Yesempty stringNo
CCCarbon Copy. Multiple Recipients can be separated by a semicolon (;) or a comma(,)Yesempty stringNo
BCCBlind Carbon Copy. Multiple Recipients can be separated by a semicolon (;) or a comma(,)Yesempty stringNo
FormatThe format of the email. Check below for more detailsNoHtml (And replace newline with <br />)No
DNN email template to use.Choose from a predefined email from the systemNoUnsetNo
SubjectThe subject of the EmailYesempty stringYes
BodyThe email content to sendYesempty stringNo
HeadersAppends custom headers to the email.YesUnsetNo
Attach Portal FilesPicks existing files from the system to send as attachments.NoUnsetNo
Attach Field #Form only parameter. It provides the ability to add up to 5 Single File Uploads fields to be sent as attachments.NoUnsetNo
Attach from TokenComputes file path from token. It must be relative to the portal home folder. Multiple items must be separated by semicolons or commas.Yesempty stringNo
Ignore ErrorsIf errors are ignored, the submission of the form continues even when there is an error sending the email. Otherwise, an error message will be displayed to the user. Note that if the email is being sent async or is placed in a pickup folder, errors won't be caught.NoNoNo

Formats

FormatDetails
HTML (And replace newline with <br />)To simplify the input of the email we are replacing the newlines in the Body of the email with the HTML tag <br/>. While it is easier to compose the email it may have strange behaviors with some email clients like Outlook
TextRegular text, with no formatting options such as bold, italics, underlines, or special layout. Can include URLs, such as http:// and ftp:// options.
HTML(Recommended)It’s the way web pages and email templates are coded so that text is formatted and images are added. What it is displayed in the HTML editor of Body will be the result that will be displayed in the email client

Security

caution

Note that this presents a security risk when the To, From, CC, BCC and Reply To parameter have tokens from untrusted sources.

The above-mentioned parameters support tokens so if the values are not coming from a trusted source they may be altered and email recipients can be modified. For example, if you let the user input the email address manually from a Form, it may present a security risk. The expectation is to input only one email address but the end-user may input: my-email@company.com;other-email@othercompany.com. Doing this he may send the emails that are meant only for him to other people or organizations. To avoid similar situations we strongly recommend using Tokens like [User:Email] or hardcoded email addresses when setting recipients parameters.

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"

}
]
}
}