Email and notifications
Send mail from Records, and alert people when Records change.
A site sends no mail until a System Manager adds an outgoing Email Account. Until then the desk shows a banner to System Managers that links to /desk/email-account/new.
Set up an Email Account
| Field | Example |
|---|---|
| Email Address | erp@acme.com |
| Enable Outgoing, Default Outgoing | ticked |
| SMTP Server | smtp.acme.com |
| Port | empty gives 465 with SSL, 587 with STARTTLS, 25 with neither |
| Use SSL or Use STARTTLS | one of them |
| Password | the SMTP password, stored encrypted |
Test it from the terminal:
cardinal email test -t erp.localhost you@acme.comTick Enable Incoming and fill the IMAP fields to read the inbox every minute. Each new mail becomes a received Communication. A reply to a mail sent from a Record lands on that Record's timeline.
Mail from a Record
Choose Email in the form menu. The composer has To, CC and BCC, a subject, a message, the Record's files and Attach Record Print. Schedule Send At sends it later. After sending, an Undo toast stays for 10 seconds.
Sent mail shows on the Record's timeline with its delivery status.
How mail goes out
Send → Email Queue row (in the save's transaction) → job sends over SMTP → SentA failed send retries, waiting 5 minutes longer each time, up to System Settings' email_retry_limit (3 by default). Then the row goes to Error and its owner gets a bell notification. Email Queue in the desk lists every row, with Send Now and Retry Sending.
Each mail tied to a Record carries an unsubscribe link, unless the account turns off Send unsubscribe message.
Unsubscribes and Email Groups
The unsubscribe link asks the reader to confirm, then writes an Email Unsubscribe row. That address gets no more mail about that Record, and the Record's timeline notes it. A row with Global Unsubscribe ticked stops all mail to the address except sign-in links. System Managers see and edit these rows at /desk/email-unsubscribe.
An Email Group is a subscriber list, such as Newsletter. Its Email Group Members are addresses, one row each, and the group counts its subscribers. Unsubscribing from mail about a group marks that member Unsubscribed. Apps send to groups. Core has no newsletter sender.
Email Templates
An Email Template has a Subject and a Response, both Jinja with doc. Set Reference RecType to offer it only on that RecType's composer.
Subject: Quotation {{ doc.name }} from Acme
Response: Dear {{ doc.customer_name }}, please find our quotation attached.Notifications
A Notification sends an alert when something happens to a Record.
| Field | Options |
|---|---|
| Channel | Email, System Notification (the desk bell), Telegram |
| RecType | e.g. Sales Order |
| Send Alert On | New, Save, Submit, Cancel, Value Change, Days Before, Days After |
| Condition | doc.grand_total > 100000 |
| Recipients | A field holding an email or User, a role, CC and BCC |
| Email Template, or Subject and Message | The text. Message is Jinja with doc |
Days Before and Days After compare a date field with today, such as a reminder 3 days before delivery_date.
Telegram needs Telegram Settings with a bot token. Each user links their own chat, and users without a linked chat get nothing.
For alerts with several steps, waits or branches, use an Automation.