Skip to main content
Version: 1.28 (Current)

Send Email (OAuth Compatible)

Audience: Business Users

Skill 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.
Action NameDescription
Send EmailSends email through the site's SMTP settings or an SMTP connector.
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.
Execute Actions for each List EntryRuns actions, such as this one, for each entry in a list.

Input Parameter Reference​

ParameterDescriptionSupports TokensDefaultRequired
ConnectorShown, but not used. The email is always sent through the site's DNN mail provider.NoDefault SMTPNo
FromThe 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.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. See Send Email.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
Attach Portal FilesFiles from the portal to attach.NoemptyNo
Attach Field #1 to #5Upload fields whose files are attached. Available in forms and grids.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 or a URL of a file on the site. Files that can't be found are skipped.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.NoemptyNo

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 EmailSend Email (OAuth Compatible)
Mail serverThe site's SMTP settings or the selected SMTP connectorThe site's DNN mail provider. Connector is ignored.
Custom headersSupportedNot available
Display names in addressesKeptRemoved, only the address is sent
Plain-text alternative for HTML emailsAdded automaticallyNot added. Only one body is sent.
Mail provider errorsCould 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​

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

tip

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