Mail Forwarding and Filtering on a Black Box

The Cyrus server is intended to run as a black box. Because users have no home directories on the Cyrus server, they cannot enable mail forwarding by creating a .forward file.


How is forwarding done without .forward files? You guessed it—user mail forwarding is from within the sendmail aliases database on a Cyrus system. To make maintenance easier, you can keep the user aliases and the system aliases in separate files:

  • System aliases should be kept in the standard /etc/mail/aliases file.

  • Users’ mail forwarding orders should be stored in another file (or files), defined in your local sendmail configuration.

Let’s suppose that we will store users’ forwarding orders in an alias file that’s named /etc/mail/forward. The format of the /etc/mail/forward file is the same as the sendmail aliases file format. To activate the /etc/mail/forward file, edit your M4 file (sendmail ships with an example,, or you may have rolled your own) and add the following line:

define('ALIAS_FILE', '/etc/mail/aliases,/etc/mail/forward')

Finally, build a new file and restart sendmail. If you don’t use an M4 macro to build your file, then edit your file and look for the lines:

# location of alias file
O AliasFile=/etc/mail/aliases

Change the definition of AliasFile to:

O AliasFile=/etc/mail/aliases,/etc/mail/forward

Because users cannot log in and directly edit their forwarding orders, they need to be allowed ...

Get Managing IMAP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.