Send Email (OAuth Compatible)
Audience:
Business UsersSkill Prerequisites:
HTML,Tokens
Sends an email to one or more recipients, with optional attachments, through the site's DNN mail provider instead of connecting to an SMTP server directly. When the site is set up with a mail provider that supports OAuth, for example for Microsoft 365 or Google Workspace, this action sends through it.
It's configured like Send Email and works the same way, apart from the differences listed in What's different from Send Email. It's available when the Email OAuth add-on is installed, alongside the standard Send Email action.
Typical Use Cases
- Send notifications and confirmations on sites whose mail server requires OAuth sign-in
- Send email through the same mail provider the rest of the site uses
Don't use it to
- Send through a specific SMTP connector. This action always uses the site's mail provider. Use Send Email with a connector instead.
- Send emails that need custom headers or sender display names. Use Send Email instead.
- Debug. Use Log Error or Log Debug Message instead.
Related Actions
| Action Name | Description |
|---|---|
| Send Email | Sends email through the site's SMTP settings or an SMTP connector. |
| 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. |
| 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 | Shown, but not used. The email is always sent through the site's DNN mail provider. | No | Default SMTP | No |
| From | The sender's address. Leave empty to use the site's default email address. Display names, such as Support <support@mydomain.com>, are removed and only the address is sent. | 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. See Send Email. | 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 |
| Attach Portal Files | Files from the portal to attach. | No | empty | No |
| Attach Field #1 to #5 | Upload fields whose files are attached. Available in forms and grids. | 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 or a URL of a file on the site. Files that can't be found are skipped. | 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. | No | empty | No |
Every email needs at least one address in 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.
What's different from Send Email
| Send Email | Send Email (OAuth Compatible) | |
|---|---|---|
| Mail server | The site's SMTP settings or the selected SMTP connector | The site's DNN mail provider. Connector is ignored. |
| Custom headers | Supported | Not available |
| Display names in addresses | Kept | Removed, only the address is sent |
| Plain-text alternative for HTML emails | Added automatically | Not added. Only one body is sent. |
| Mail provider errors | Could not send email from ... to ... | DNN Mail.SendMail failed: followed by the provider's message |
Everything else, including formats, templates, attachments, sending to all users and error handling, works as described in Send Email.
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, a user could enter user@example.com;attacker@example.com into a form field and have a message sent to someone else. Use tokens such as [User:Email], or fixed addresses, for recipients whenever you can.
Examples
To understand how to use the below examples, please see Running Examples.
The examples use "ActionType": "SendMailOAuth". In example 3, the sender's display name is removed when the email is sent.
1. Simple Email
{
"Title": "Send Email",
"ActionType": "SendMailOAuth",
"Description": "Simple example, confirmation email (OAuth compatible)",
"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>",
"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. Tokenized Email
{
"Title": "Send Email",
"ActionType": "SendMailOAuth",
"Description": "Email with tokenized values (OAuth compatible)",
"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 with tokens.</p>",
"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. Complex Email With Attachment
{
"Title": "Execute Actions",
"ActionType": "ExecuteActions",
"Description": "Complex OAuth email with logo attachment",
"Parameters": {
"ActionList": [
{
"ActionType": "InjectData",
"Parameters": {
"Data": [
{ "value": "/Images/logo.png", "name": "Path" }
]
}
},
{
"Title": "Send Email",
"ActionType": "SendMailOAuth",
"Parameters": {
"From": "The Sender <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": { "Value": "Html" },
"DnnEmailTemplate": { "Value": "" },
"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>",
"PortalFiles": "",
"FileField1": { "Value": "" },
"FileField2": { "Value": "" },
"FileField3": { "Value": "" },
"FileField4": { "Value": "" },
"FileField5": { "Value": "" },
"FileToken1": "[Path]",
"IgnoreErros": ""
}
}
]
}
}
4. Send to All Users Loaded Into Context
{
"Title": "Execute Actions",
"ActionType": "ExecuteActions",
"Description": "Send email to all loaded users (OAuth compatible)",
"Parameters": {
"ActionList": [
{
"ActionType": "LoadUsersFromSql",
"Parameters": {
"SqlQuery": "SELECT UserId from Users"
}
},
{
"Title": "Send Email",
"ActionType": "SendMailOAuth",
"Parameters": {
"From": "support@plantanapp.com",
"To": "",
"ToAllUsers": true,
"ReplyTo": "",
"Cc": "",
"Bcc": "",
"Subject": "Example",
"Format": { "Value": "Html" },
"DnnEmailTemplate": { "Value": "" },
"Body": "<p>Dear Customers,</p><p>This is an example.</p>",
"PortalFiles": "",
"FileField1": { "Value": "" },
"FileField2": { "Value": "" },
"FileField3": { "Value": "" },
"FileField4": { "Value": "" },
"FileField5": { "Value": "" },
"FileToken1": "",
"IgnoreErros": ""
}
}
]
}
}
5. Send Email for Each Entity in List
{
"Title": "Execute Actions",
"ActionType": "ExecuteActions",
"Parameters": {
"ActionList": [
{
"ActionType": "LoadEntitiesFromSql",
"Parameters": {
"SqlQuery": "select Firstname, Lastname, Email, CreatedOnDate, Username from Users",
"EntityName": "UserDetails"
}
},
{
"ActionType": "ExecuteActionsOnEntityList",
"Parameters": {
"EntityName": "UserDetails",
"ActionList": [
{
"Title": "Send Email",
"ActionType": "SendMailOAuth",
"Parameters": {
"From": "support@plantanapp.com",
"To": "[UserDetails:Email]",
"Subject": "Created date for [UserDetails:Username]",
"Format": { "Value": "Html" },
"Body": "<p>The user: [UserDetails:Firstname] [UserDetails:Lastname] was created on date [UserDetails:CreatedOnDate]</p>",
"PortalFiles": "",
"FileField1": { "Value": "" },
"FileField2": { "Value": "" },
"FileField3": { "Value": "" },
"FileField4": { "Value": "" },
"FileField5": { "Value": "" },
"FileToken1": "",
"IgnoreErros": ""
}
}
]
}
}
]
}
}
Tips
- The email is sent through the mail provider configured for the site. To send through OAuth, set up an OAuth-capable mail provider for the site first.
- For large mailings, check your mail account's sending limits.
Revised 09/25/2026