Jump to Navigation

081 - Creating aliases and mail redirects

A simplest way to redirect mail (either from users who don't exist, or from users who do exist) is with the /etc/aliases file.
The format is pretty simple:

admin: root,webadmin
support: support@mydomain.com,webmaster@mydomain.com

Note that the /etc/aliases file is read before local delivery takes place; so if you want to redirect the mail of a user who does actually exist,
you can just add an entry for their name, and then specify where you'd like mail redirected to.

Editing this file deserves a bit of caution:

The file itself is not read by sendmail; a database is created from the file, and *that* is then read by sendmail (this is done for speed reasons).
It's no longer rebuilt automatically (for security reasons); so you *must* remember to rebuild the aliases database immediately upon exiting editing the file
(otherwise the log will fill with errors, one for every mail sent).

This is done with the 'newaliases' command. To make sure you always remember to rebuild the database.

[MyServer]# newaliases


Main menu 2

Story | by Dr. Radut