| 1 | --- Setting up /etc/aliases |
| 2 | |
| 3 | Create /etc/aliases if it does not already exist. You should include |
| 4 | forwarding instructions for mailer-daemon, postmaster, and root: |
| 5 | |
| 6 | root: alias |
| 7 | postmaster: alias |
| 8 | mailer-daemon: alias |
| 9 | |
| 10 | Note that qmail never delivers mail to root. The instructions shown here |
| 11 | will deliver messages to the mailbox of the ``alias'' user. |
| 12 | |
| 13 | For further details on the format of /etc/aliases, and a list of |
| 14 | sendmail compatibility warnings, see the newaliases man page. |
| 15 | |
| 16 | |
| 17 | --- Compiling /etc/aliases |
| 18 | |
| 19 | Once /etc/aliases is ready, run newaliases to compile /etc/aliases into |
| 20 | /etc/aliases.cdb: |
| 21 | |
| 22 | # newaliases |
| 23 | |
| 24 | Review /etc/aliases.cdb to make sure it has the instructions you want: |
| 25 | |
| 26 | % printforward < /etc/aliases.cdb | more |
| 27 | |
| 28 | For the format of printforward's output, see the setforward man page. |
| 29 | |
| 30 | If you change /etc/aliases you will have to run newaliases again. You |
| 31 | may want to add a comment at the top of /etc/aliases as a reminder. |
| 32 | |
| 33 | |
| 34 | --- Compiling :include: files |
| 35 | |
| 36 | If you have an :include: file, say /etc/staff-list, compile it into |
| 37 | /etc/staff-list.bin: |
| 38 | |
| 39 | # newinclude /etc/staff-list |
| 40 | |
| 41 | See the newinclude man page for a list of sendmail compatibility |
| 42 | warnings. Review /etc/staff-list.bin: |
| 43 | |
| 44 | % printmaillist < /etc/staff-list.bin | more |
| 45 | |
| 46 | For the format of printmaillist's output, see the setmaillist man page. |
| 47 | |
| 48 | If you change /etc/staff-list you will have to run newinclude again. You |
| 49 | may want to add a comment at the top of /etc/staff-list as a reminder. |
| 50 | |
| 51 | |
| 52 | --- Configuring qmail to use /etc/aliases |
| 53 | |
| 54 | To activate /etc/aliases, put this line into ~alias/.qmail-default: |
| 55 | |
| 56 | | fastforward -d /etc/aliases.cdb |
| 57 | |
| 58 | If qmail is already running, make sure to chmod +t ~alias before you |
| 59 | edit .qmail files in ~alias, and chmod -t ~alias after. |
| 60 | |
| 61 | |
| 62 | --- Testing aliases |
| 63 | |
| 64 | To check the expansion of postmaster@your.host without sending any mail: |
| 65 | |
| 66 | % env DEFAULT=postmaster HOST=your.host fastforward -nd /etc/aliases.cdb |
| 67 | |
| 68 | Replace your.host with your fully qualified domain name. Make sure to |
| 69 | include the -nd. |
| 70 | |
| 71 | Next, try sending a message to postmaster@your.host. Watch the qmail log |
| 72 | and the final mailbox to make sure the alias works the way you want. |
| 73 | |
| 74 | You can check other aliases the same way. |
| 75 | |
| 76 | |
| 77 | --- Using /etc/aliases for virtual domains |
| 78 | |
| 79 | To put all addresses at virt.dom under control of /etc/aliases, add |
| 80 | |
| 81 | virt.dom:alias |
| 82 | |
| 83 | to /var/qmail/control/virtualdomains, and give qmail-send a HUP signal. |
| 84 | Also add |
| 85 | |
| 86 | virt.dom |
| 87 | |
| 88 | to /var/qmail/control/rcpthosts so that qmail accepts mail for virt.dom |
| 89 | from remote hosts. Now you can handle virt.dom in /etc/aliases: |
| 90 | |
| 91 | billing@virt.dom: joe, fred |
| 92 | (this line catches all other addresses)@virt.dom: joe |
| 93 | |
| 94 | Note that postmaster@virt.dom will go to joe; the @virt.dom instruction |
| 95 | overrides the postmaster instruction. Note, however, that other .qmail |
| 96 | files in ~alias override ~alias/.qmail-default, so you can set up |
| 97 | ~alias/.qmail-postmaster to handle postmaster@everything. |
| 98 | |
| 99 | Beware that sendmail does not support domain-specific instructions in |
| 100 | /etc/aliases; they are a fastforward feature. |