Automating common tasks with Sieve scripts
With the volume of mail and it's importance, it's essential to manage common tasks with automation. Sieve - the mail filtering language, is designed for filtering email messages at the time of final delivery. It is suitable for running on a mail server where users may not be allowed to execute arbitrary programs as the base language has no variables, loops, or ability to shell out to external programs.
Although administrators can manage scripts on behalf of users using dbmail-sievecmd, most users are expected to manage their own email rules.
Email clients
Microsoft Outlook, Apple Mail, Thunderbird, Kate, Roundcube and many other email clients support Sieve scripts.
Sieve daemon
ManageSieve is provided by the dbmail-sieved service daemon. A ManageSieve server typically listens on port 4190, this can be changed in dbmail.conf.
DNS
Although users can enter connection details manually, there is a SRV record for discovering a setting.
- _sieve._tcp.example.net.
Example scripts
The following scripts can help with automating sales, support and any outreach campaign.
By filtering emails into folders, optionally replying with a standard message to confirm receipt, it's possible to collect emails into folders.
# rule:[SaleEnquiry] if anyof (header :contains "Subject" "[Sales Enquiry]", header :contains "Subject" "[More Info]") { fileinto "Sales/TODO"; stop; } # rule:[CV] if anyof (header :contains "subject" "[CV for Job]", header :contains "Sender" "automated@agency.example.com") { fileinto "Candidates/Filter"; stop; } # rule:[Support] if allof (header :contains "subject" "Support") { vacation :subject "Support" "Thanks for your support request, we will respond as soon as we can."; fileinto "Support";
stop;
}
Automating CRM and other services
As IMAP is a common standard for managing mail, it's straightforward to poll an email address or folder and automatically process messages.