Advanced email configuration

The web interface for configuring email addresses manipulates standard Exim .forward files in your home directory. You can of course create and edit these files directly, if you prefer. (You might find it simplest to use the web interface to create an initial file in the right format, then edit it from there.)

Each email address is controlled by the file named .forward-domaingroup-localpart, for example .forward-lglass-alice. (If you've used the default null domaingroup, then it's just .forward-localpart.)

At the simplest level you can configure all your email to be forwarded to a single email address by creating a .forward-default file in your home directory containing the address you want your email forwarded to. (Note that your .forward files need to be world readable so that Exim can verify valid email addresses before accepting mail.) Note that **creating a default .forward file is not recommended** as spammers often make up random local-parts to send mail to such as common first names

For example, if your domain is foobar.co.uk, username foobar and you create a ".forward-default" file containing "me@bar.com" then all mail to foobar.co.uk will be forwarded to me@bar.com.

If instead you'd prefer to forward email to different places depending on whom it's addressed to then you can create a .forward-<local-part> file containing the email address to forward to.

Taking the above example, if we added a ".forward-sales" file containing "alice@rabbithole.com" then any email to sales@foobar.co.uk would be forwarded to alice@rabbithole.com, while all other email to foobar.co.uk would go to me@bar.com.

By removing the .forward-default file you can make us only accept mail for addresses at your domain you have specified with .forward-<user> files.

So, again taking our above example, if we delete the .forward-default file mail to sales@foobar.co.uk will be forwarded to alice@rabbithole.com while all other mail to foobar.co.uk will be bounced with a message saying that the email address doesn't exist. This means that if you have no .forward-<local-part> files and no .forward-default file then no email address at your domain will work.

If you wish to have mail end up in your POP3/IMAP mailbox then instead of putting an email address in the .forward files above you simply create a file containing /home/<username>/Maildir/. You can create more POP/IMAP mailboxes through the web interface mentioned above. If you have configured additional POP3/IMAP mailboxes then you can specify these by putting /home/<username>/popboxes/<popusername>/Maildir/ into the .forward file, with popusername being the username that you use to access the mailbox you wish the mail to go into but with the @ in the username replaced by a %.

Thus, with the above example in mind, if we recreate the .forward-default file but put /home/<username>/Maildir/ in it mail to sales@foobar.co.uk will be forwarded to alice@rabbithole.com while all other mail to foobar.co.uk will end up in foobar's POP3/IMAP mailbox.

Or for Alice's mail if you create a new mailbox with the popusername alice@domainname.co.uk then to forward mail to this box you would place /home/<username>/popboxes/alice%domainname.co.uk/Maildir/ in the appropriate .forward file.

If you want to have all email for <local-part>-anything treated in a particular way you can create a .forward-<local-part>-default which will forward <local-part>-anything in that particular way.

All messages in your POP3/IMAP mailbox (and indeed even those forwarded through Black Cat) contain an "X-BlackCat-To:" header allowing you to tell who the message was actually to at your domain. This is useful if you're using something like fetchmail to pick up mail from your POP3/IMAP mailbox or are forwarding all your email to one address.

The format of the "X-BlackCat-To:" header is <username>-<local-part>@<domain>. For example, an email to sales@foobar.co.uk would be forwarded to alice@rabbithole.com including a header "X-BlackCat-To: foobar-sales@foobar.co.uk".

Multiple domains

If you have multiple domains, the way they are handled depends on whether the domain has a subuser associated with it, and if so, what it is. All domains with the same subuser have the same alias files applied to it.

If the subuser is blank (the default) then the domain's alias configuration will be handled as above. Otherwise, you will need to add the subuser into the filenames. Example: .forward-mysubuser-myalias or .forward-mysubuser-default.

The subuser will initially be set when ordering a domain pointing. You can change it later - see "Manage mail domain subusers" in the control panel described above

Exim filters

We also allow exim filter files to be uploaded as any of your .forward-blah files. Please create a normal Exim filter and then upload it in place of the relevant alias you wish to filter.

The pipe command is restricted and we would urge people not to use it but rather use alternatives in the filter language itself. We do allow fail and defer in user filters.

The filter files should follow the Exim 4 filter specification

Shell account users can test filters with exim -bF, but will need to manually specify an exim configuration. You can use the following command to test forward file .forward-foo with a test email in message.eml:

/usr/sbin/exim -C<(zless /usr/share/doc/exim4-base/examples/example.conf) -bF .forward-foo < message.eml

If you can't find what you're looking for feel free to contact us