Here is how I done it
create user webmail
adduser webmail
I had to install the postfix-pcre package.
Code:
sudo apt-get install postfix-pcre
I created a file called /etc/postfix/virtual as follows:-
Code:
/.*/ webmail
edited /etc/postfix/main.cf
to add this line:
virtual_alias_maps = pcre:/etc/postfix/virtual
For the absolute newbies (like me), if the configuration is correct, the query command:
Code:
postmap -q test@a pcre:/etc/postfix/virtual
would return the email id specified in virtual file (/etc/postfix/virtual). In this case.
Code:
webmail
To test the working, use the mail command from the terminal.
Code:
mail testmail@example.com
enter the subject, mail body and press Ctrl+D (to exit the compose window).
To view the message use the following command. (webmail is the mail id configured in virtual file. Substitute with your name.)
Code:
mail webmail
PS:To check the mail log use the following command.
Code:
tail -f /var/log/mail.log