How do SIEVE and procmail interact?
Most users don't need to know any of this. If you do, or if you're interested in highly technical details, read on...
Mail is received at ENCS by the Postfix SMTP agent, which, by default, hands a message off for local delivery to dovecot-lmtp (with the Pigeonhole SIEVE processor).
Note that Postfix looks for a user's ".forward" file first, so one could bypass SIEVE (dovecot-lmtp) altogether by putting this in ".forward":
"|/local/bin/procmail -f-"
However, it's not necessary to do this, as we have configured our mail system to give the message to procmail if it is not delivered from the SIEVE script.
Assuming that you do not have a ".forward" file, here's what happens when a message arrives and is handed off to dovecot-lmtp:
- System-wide "sieve_before scripts" run. (In our case, this merely logs the arrival of the message into dovecot.)
- If the message is not yet fully delivered (this is always the case), all user-level "sieve_before scripts" run, that is, any scripts found in ~/.sieve/before/; usually none are present.
- If the message is not yet fully delivered (one would expect this to be the case), the main script runs: if the user has ~/.sieve/ACTIVE, it is used. Otherwise, the system default SIEVE script runs, which does nothing.
- If the message is not yet fully delivered, then all user-level "sieve_after scripts" run, that is, any scripts found in ~/.sieve/after/.
- If the message is not yet fully delivered, then system-wide "sieve_after scripts" run, and in particular, if the user has a ".procmailrc" file, then the message is handed off to procmail.
- If the user has no ".procmailrc" file (or if for some reason procmail failed), then the default action is taken: the message is filed into the user's INBOX.
So...
- If you have no SIEVE scripts and no .procmailrc file, your mail will simply be filed into your INBOX by dovecot.
- If you have SIEVE scripts but no .procmailrc file, your SIEVE rules will be followed, and the message handled as indicated. If it is not yet delivered by the end of your script(s), it will be filed into your INBOX by dovecot.
- If you have a .procmailrc file but no SIEVE scripts, procmail will be used to deliver your mail, and if your procmail script does not explicitly deliver the message, then your mail will be filed into your INBOX by procmail.
- If you have both, then your SIEVE rules will be executed first, and the message will be handed off to procmail only if it is not completely delivered by dovecot (SIEVE). You should probably avoid this situation unless you know exactly what you're doing, or you're likely to accidentally duplicate actions, such as forwarding.
Special notes about SIEVE "keep"
- SIEVE "keep" will always cause delivery of (a copy of) the message to INBOX, and mail processing will end at the end of the current script (or when "stop" is encountered in the current script). So once "keep" has been encountered, the message will never be punted to procmail.
- Likewise, the way Ingo implements "forward with keep" garantees that if the message is not delivered by the end of the script, it will be filed into the main INBOX, and never punted to procmail. So don't "forward with keep" from Horde and expect to use procmail. Instead, you can "redirect" (without stop).
- GCS Service Centre
- Open a Ticket
- Getting Support
- Knowledge Base (FAQ)
- ENCS User Quick Reference Guide
- Email FAQ
- How do I share large files via ENCS email?
- How do I use the MH e-mail clients (nmh and exmh)?
- Automation of mail delivery at Gina Cody School
- How do I configure ENCS email delivery with SIEVE?
- How do SIEVE and procmail interact?
- How do I configure ENCS email delivery with procmail?
- How do I have my ENCS email delivered to a folder other than "inbox"? (Windows)
- How do I connect to a GCS Public Lab computer from outside of the Concordia network?
- How do I connect to a GCS office or graduate research lab computer from outside of the Concordia network?
- Where can I access Matlab software on campus and remotely?
- How do I activate my GCS Microsoft Software License?
- How do I recover files from the GCS Backup System?
- How do I remotely access server consoles (IP KVM)?
- How do I remotely launch X(Graphical) applications?
- How do I securely connect to a GCS server?
- What is an ssh tunnel and how does it work?