MailDesk docs
Odoo integrations

Automate incoming email

8 min read Odoo 18.0

Create rules that tag, file, route, answer or turn emails into CRM leads and Helpdesk tickets when they arrive, and check what each rule did in a log.

Who this is for: MailDesk administrators who set up rules. Users with the MailDesk Automation User group can read the execution log and the rule templates.

You need:

  • The MailDesk Automation Engine module (maildesk_mail_client_automation).
  • MailDesk Pro, and MailDesk Basic below it.
  • A connected mailbox that syncs.
  • For some actions, the matching bridge module (see the list in Step 4). No Odoo app is required for the engine itself.

Which MailDesk edition includes this module is described in Plans and included features.

Before you begin

  • Install the module. Install steps are in Install MailDesk.
  • Automation is off by default on every mailbox. Nothing runs until you turn it on for a mailbox (Step 1).
  • Start with one busy mailbox and a few rules. Check the log before you add more.
  • The access groups are in Who can do what below.

How rules work

A rule belongs to one mailbox. It has:

  • a trigger: when the rule runs;
  • optional conditions: which emails it applies to (all conditions you fill in must match);
  • one or more actions: what it does.

The engine runs each action at most once for a given email, or once for a whole conversation if you choose that scope. This stops duplicate leads, tickets and replies for one message.

Step 1: Turn on automation for a mailbox

  1. Open MailDesk ▸ Configuration ▸ Mailboxes ▸ Mailbox Accounts and open the mailbox.
  2. Open the Settings tab and find the card Rules & Automation Engine.
  3. Switch Enable on.
  4. Under Execution Triggers, choose whether rules run on incoming mail, on mail you send from MailDesk, or both. Both are on by default. The option Ambient AI: Classify Every Incoming Email is off by default.
  5. Save the mailbox.

The Rules and Automation Engine card on a mailbox account, with the Enable toggle

What you should see: the card shows Create Rule from Template and Open Automation Rules. The mailbox form also shows a Rules counter.

Step 2: Create a rule

  1. Open MailDesk ▸ Automation ▸ Automation Rules.
  2. Click New, and give the rule a clear name. You can also click New from Template (see below) or Create with MailDesk AI.
  3. In 1. When Should This Rule Run?, choose the mailbox and the trigger.
  4. In 2. Which Emails Should Match?, fill in only the filters you need: Sender contains, Sender domain, Subject contains, whether the email has attachments, and whether it is a reply. Leave the others empty.

A new rule form: when the rule runs, which emails match, and what happens

The matching filters of a rule: sender, subject, attachments and replies

What you should see: the form reads from top to bottom like a sentence. A rule preview in plain words shows what the rule will do.

A plain-language preview of what a rule will do before it runs

For cases the simple filters cannot express, the form has Advanced Matching (Only When Standard Filters Are Not Enough) and AI Conditions (these match on the AI insight of an email and need MailDesk Pro AI features).

Step 3: Choose the trigger

Trigger When the rule runs
Incoming After MailDesk takes in a new incoming email.
After Send After you send an email from MailDesk.
No Reply / Deadline Passed Once for an incoming email that has waited too long for an answer, or whose deadline has passed. You set the time limit on the rule. These rules are checked every ten minutes.
Manual Only when an administrator runs it from the email's Automation panel.

Choosing a trigger for a rule

An incoming rule acts on new mail only

An incoming rule matches emails that arrive after you create it. It does not act on mail that is already in the mailbox, unless you switch on Include Older Emails Already in Inbox. That option can match old messages, so use it with care.

Step 4: Choose the actions

Add one or more actions to the rule.

Action What it does Needs
Add Tag, Remove Tag Labels or unlabels the email with a MailDesk tag.
Move to Folder Files the email in another folder of the same mailbox.
Star Email, Mark as Read, Set Priority, Mark as Needing a Reply, Set a Deadline Changes the state of the email.
Create CRM Lead Creates a lead from the email, or reuses the one the conversation already has. CRM bridge
Create Helpdesk Ticket Creates a ticket from the email, or reuses the existing one. Helpdesk bridge
Create Time Off Creates a time-off record. The Time Off bridge
Link Existing Record Links the email to a record you already have in Odoo. The bridge of that record type
Create Activity Schedules a follow-up activity for a colleague.
Notify User, Notify Channel Sends a Discuss message to a person or a channel.
Auto-Reply to Sender Sends an automatic reply. It appears in your Sent folder.
Forward Email, Assign an Owner Forwards the email, or assigns an owner.
Wait, Then Continue, If / Otherwise, Stop the Flow Controls the order of steps in a flow.
AI: Classify (ensure brief), AI: Choose the Path, AI: Draft a Reply for Review AI steps. MailDesk Pro AI features

A rule that uses an action whose bridge is not installed is skipped. The log records the skip; it does not fail.

Adding actions to a rule

Notification and auto-reply text can use the variables {subject}, {from_name}, {from_addr} and {account_name}. Notification text can also use {preview}. The auto-reply has loop guards: it does not reply to the mailbox's own address or to automatic senders.

Choose the scope to avoid duplicates

Each action has a scope. Per Message runs once for each matching email. Per Thread runs once for the whole conversation, so you get one lead or ticket per conversation. Per Interval runs at most once in the number of minutes you set, which limits notifications. You can also limit an action to a date range, for example for a holiday auto-reply.

Test before you go live

Review every rule and template before you rely on it. Templates use example values such as a placeholder sender domain.

Step 5: Start from a template (optional)

  1. Open MailDesk ▸ Automation ▸ Automation Rules and click New from Template. You can also click Create Rule from Template on the mailbox card.
  2. Pick a template and the mailbox.
  3. Confirm. The wizard creates the rule and its actions.

The wizard that builds a rule from a ready-made template

What you should see: the new rule in the rule list. Review and adjust it before use.

The built-in templates include: Star VIP Senders, Move Newsletters to Folder, Tag Urgent Emails, Auto-Create CRM Lead, Auto-Create Helpdesk Ticket (Keywords), Auto-Reply: Acknowledge Receipt, Auto-Reply: Out of Office, Post New Emails to a Discuss Channel, and Route Invoice Attachments to Finance Folder, among others.

Step 6: Check what ran

Open MailDesk ▸ Automation ▸ Automation Executions. Each row shows the rule, the action and the result: Planned, Executed, Skipped or Failed, with the reason for a skip.

The execution log with every rule, action and result

What you should see: a row for each action that ran or was skipped.

A scheduled job removes old log rows. Executed and skipped rows are kept for about 90 days, and failed rows for about 180 days.

Test on one email

Open an email in MailDesk and open its Automation panel. It shows the recent executions for that email. Administrators also see Rerun Rules and Dry Run:

  • Rerun Rules evaluates the active Manual rules for this email. It does not replay the original incoming flow.
  • Dry Run evaluates the same manual rules and writes log entries without doing anything real.

The Automation panel on an email with Rerun Rules and Dry Run for administrators

Examples

Turn enquiries into CRM leads. A sales email creates one lead for the conversation.

A sales email that became a CRM lead

Open Helpdesk tickets. A support request creates a ticket when it arrives.

A support request that opened a Helpdesk ticket

Acknowledge the sender. An automatic reply uses the sender's name and the subject.

An automatic acknowledgement reply with the sender's name and subject

Tell a colleague. Schedule an activity or post to a Discuss channel.

A follow-up activity and a notification created by a rule

Who can do what

Two groups ship with the module. Assign them in Settings ▸ Users & Companies ▸ Users, in the category MailDesk Automation.

Group Can do
MailDesk Automation User Read the execution log (Automation Executions) and Rule Templates. Only Automation Admins open the rule list.
MailDesk Automation Admin Everything the user can do, plus create, edit and delete rules, use templates, run Rerun Rules and Dry Run.

In a multi-company database, users see only the rules and logs of mailboxes that belong to their companies. System administrators see all.

If it does not work

Symptom Check Safe next step
A rule did not run. Is Enable on for the mailbox? Is the trigger option under Execution Triggers on? Is the rule active? Fix the setting. Then check Automation Executions for the email.
An incoming rule ignores old emails. Include Older Emails Already in Inbox is off by default. Leave it off, or switch it on knowing that old mail can match.
A log row says Skipped for a CRM or Helpdesk action. The log reason. The bridge module or the Odoo app may not be installed. Install the CRM or Helpdesk bridge.
You see no Automation menu or no Rerun Rules button. Your group. Ask an administrator for MailDesk Automation User or MailDesk Automation Admin.
Auto-reply is not sent. The log reason. The reply is skipped for the mailbox's own address and for automatic senders. Check the reply text and the scope of the action.

For other problems, see Troubleshooting.

Next step

Monitor email operations with Cockpit shows the state of your mailboxes (separate add-on).