Send E-Mail – sending a mail from an action¶
The command "Send E-Mail" sends a mail through an SMTP server or Microsoft Exchange Online, without showing anything to a user. This page is for administrators who send notifications, confirmations or reports from actions.
1. At a glance¶
| Purpose | Send a mail with recipients, subject, body and attachments computed by expressions |
| Typical use | Order confirmations, notifications from business rules, scheduled reports |
| Where in the editor | Toolbar menu "Communication" → "Send E-Mail" |
| Needs a user interface | No – works in scheduled actions, background rules and mailbox listeners |
| Related | Open E-Mail Form, Get File Data, Export Query |
To let a user check and change the mail before it goes out, use Open E-Mail Form; its send action then contains this command.
A failed send does not stop the action, and the action does not learn about it. The reason is written to the log.
2. Settings¶
All settings are on the tab "General", below "Display Name", "Description" and "Execution Condition" (see Actions). Except for the credentials and the three drop-down lists, all settings are expressions.
| Setting | Meaning | Default / Required |
|---|---|---|
| "Credentials" | "SMTP Credentials" or "Exchange Online Credentials" the mail is sent through | Required |
| "From" | Sender address, plain or as Name <address> |
Empty: see section 3 |
| "To" | Recipients: addresses separated by ;, or a JSON array of addresses. Name <address> is allowed. |
At least one of To, CC, BCC |
| "CC" | Copy recipients, same format | Empty |
| "BCC" | Blind copy recipients, same format | Empty |
| "Subject" | Subject line | Empty |
| "Body" | The text of the mail, as plain text or HTML according to "Format" | Empty |
| "Attachments" | Files to attach, as JSON (see below) | Empty |
| "Priority" | "Normal", "Low" or "High". The mail is marked accordingly; how the mail program of the recipient shows it is up to that program. | "Normal" |
| "Format" | "PlainText" or "Html". "None" sends plain text. | "None" |
| "Conversation Id" | Whether the conversation ID is shown to the recipient: "Do not add", "End of the body" or "End of the subject" | "Do not add" |
Attachments¶
"Attachments" expects JSON with a Files array. Each entry has FileName, MimeType and
Base64Data:
{
"Files": [
{ "FileName": "offer.pdf", "MimeType": "application/pdf", "Base64Data": "JVBERi0xLjcK..." }
]
}
This is exactly the format of the special variable "Send E-Mail Attachments" that Open E-Mail Form hands to its send action. Entries without file name or content are left out.
3. Behaviour¶
- If the credentials are not set or no longer exist, the command is skipped.
- The expressions are evaluated. In the recipient fields, entries without
@are dropped. If To, CC and BCC are all empty afterwards, the command is skipped. - Sender: with Exchange Online, the mail is sent from the mailbox of the credentials, and an empty "From" uses that mailbox. With SMTP, an empty "From" uses the user name of the credentials if it is a mail address; otherwise the mail is not sent.
- With "Conversation Id" set, nexxcite adds a token such as
[NXC-K7M2Q9XT4BVR]to the end of the subject or the body. If the recipient replies, a mailbox listener can assign the reply to the same record (see Mailbox listeners and Global settings). - The mail is sent. With Exchange Online, a copy is kept in the sent items of the mailbox.
- nexxcite records every mail an action sends, with the record it was sent from and the action that sent it – also when sending failed. The mails are listed under Admin Studio → Communication → Outgoing E-Mails (see Communication).
- If sending fails – server not reachable, sign-in refused, an attachment that is not valid base64 – the reason is written to the log. The action continues.
4. Examples¶
Order confirmation.
- "Credentials"
Sales mailbox(Exchange Online) - "To" = the mail field of the customer
- "Subject"
Your orderfollowed by the order number - "Body": an HTML text expression with the order data, "Format"
Html - "Conversation Id"
End of the subject, so that replies arrive at the order
Send a nightly export as attachment. A scheduled action
runs Export Query with "Output Format" XLSX into the variable Export.
"Attachments" is a Modify Value expression that builds the JSON with the rules
JObjectSetProperty and JArrayAppend from Export, the file name orders.xlsx and the content type
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.
5. Limitations¶
- No error variable: whether the mail went out is only visible in the log and under Communication → Outgoing E-Mails.
- Recipients are not checked beyond the
@. An invalid address is refused by the mail server. - With SMTP, a sender other than the account of the credentials is only accepted if the mail server allows it; with Exchange Online, the mailbox needs the right to send as that sender.
6. Related pages¶
- Actions and Variables
- Open E-Mail Form
- API access and credentials – SMTP and Exchange Online credentials
- Mailbox listeners
- Global settings – conversation ID prefix