Mail server configuration
From Oxxus Wiki
Mail setup on our VPS servers is mostly pre-configured. Postfix main configuration is located at /etc/postfix/main.cf file. After every change, you need to reload the new configuration with a command:
[root@test ~]# postfix reload postfix/postfix-script: refreshing the Postfix mail system [root@test ~]#
Contents |
Adding new domains to recipient list
The default domain that mail server will receive e-mails for is defined by your VPS hostname. To add additional, you will have to edit main.cf and find mydestination directive. For example, if you want to add mydomain.com, you will change mydestination to: mydestination = $myhostname, localhost.$mydomain, localhost, mydomain.com
Adding hosts to relay list
To add an IP for permanent smtp relay, you need to edit main.cf and find mynetworks directive. You will add comma seperated list of the IPs or IP masks that you want to allow relay for through your smtp server. For example, if you want to add 64.232.121.32 ip and allow relay for it on your SMTP server:
mynetworks = 127.0.0.0/8, 64.232.121.32
Please note that adding IP masks that are too general, can result in open relay and thus RBL servers can blacklist your IP address as you are allowing too many users to pass through your smtp server. The advice is to keep network masks to your own network only.
Adding e-mail aliases
You need to edit /etc/aliases and at the end of the file add alias in format:
alias: email (or emails comma seperated)
For example, if you have a mailbox mark and you want to forward from webmaster@yourdomain to mark@yourdomain, you need to add the following line: webmaster: mark
You can also add multiply e-mails in format: webmaster: mark, [email protected], [email protected]
Notes
After finishing with editing of /etc/aliases file, you need to rebuild alias database with newaliases command.