Greg's Blog

helping me remember what I figure out

Setting Up Email Forwarding

| Comments

In this document I will show you two methods of configuring e-mail forwarding on a Linux mail server. You will need to have superuser access rights or login as root. Secondly you will need to know how to use the Vi editor (see Basic Vi editing for an introduction). Also in the examples don’t type the information in brackets, unless othewise specified, as it’s only their for comment purposes.So let’s get cracking. Using .forward In the first method we will create a file in the users home directory. So change to the user’s directory (in our example it will be jsmith [Or our trusty John Smith user]). There you will have to create a file called .forward using vi. In the file you will enter the e-mail address where all the messages are to be forwarded to. Follow the example below and substitute jsmith for your user’s name. cd /home/jsmith vi .forward (enter the e-mail address to which all incomming messages are to be forwarded) jsmith@otherdomain.com (save and quit the file) You have now configured all of John Smith’s e-mails to be sent to jsmith@anotherdomain.com Using the aliases file The second method is to use the aliases file. So just open the file in your Vi editor and create a new category at the end of the file called forwarding. There you will enter the username and point to the new address. The example below should help clarify this: vi /etc/aliases (scroll to the end of the file and insert the following statements) # Forwarding jsmith: jsmith@anotherdomain.com (save and quit the aliases file and enter the following command) sendmail -bi This method allows for better centralised control, as all the information is stored in one place and therefore easier to maintain. Again I hope you found this tidbit of information useful.