How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

March 7, 2014

qmail mail forwarding aliases

Filed under: Linux — Tags: , , — admin @ 1:29 pm

Email forwarding for your domain is controlled by special files you put in your home directory. All of these files begin with “.qmail-” and end with the username.

For example, joe@yourdomain.com would be controlled by the file “.qmail-joe”. This is a text file, containing the list of destination addresses, one address per line.

If the file is empty (0 bytes), mail for that user will be delivered to you. (You need to be sure the file is zero bytes, an empty file of just one blank line will not work.)

These files must be uploaded in ASCII mode.

There is one special username called “default” (use the file “.qmail-default”) that will forward all mail for your domain that is not already specified with its own forwarding file.

If this file is 0 bytes, all mail going to anybody at your domain will be delivered to you.

If you have a separate POP3 account for your domain, you need to forward the mail to that user. For example, a POP3 account named “jack” needs to have a “.qmail-jack” file with just the word “jack” inside.

If you don’t do this, mail for jack will be delivered to the address given in the “.qmail-default” file (or to yourself if it’s empty). If you don’t have a default forwarding and don’t set the forwarding for jack, mail to jack will be returned with a “user unknown” error message.

For email addresses with a dot in it (first.last@yourdomain.com), you need to change the . to : in the “.qmail-” file.
For example, joe.blow@yourdomain.com is controlled by the file “.qmail-joe:blow”.

Be careful to never have any blank lines or spaces in a “.qmail-” file, and always put each destination address on a different line.

So for example for user test@example.com if we want to forward all e-mail and keep a copy we will have the file .qmail-test with this into example directory :
&test@test2.com
./test/Maildir/

Powered by WordPress