1. | Log in as root, or use su to become root. |
2. | cd /etc/postfixOr, if you're using FreeBSD, cd /usr/local/etc/postfix
|
3. | Use your favorite text editor to edit the main.cf file. This is Postfix's main configuration file.Lines that begin with a # character are comments. Blank lines are ignored.You can use $variablename to reference another variable configured previously in the file.The sections mentioned in the steps below are just headings in comments. Postfix's configuration files aren't organized in specific sectionsthe configuration lines can appear anywhere in the file. |
4. | Search for the INTERNET HOST AND DOMAIN NAMES section. |
5. | Add a myhostname line: myhostname = full.hostname
Where full.hostname is your fully qualified hostname. |
6. | In the SENDING MAIL section, add a myorigin line if you want your email to appear to come from a different domain or host: myorigin = domain
For example, you might use your ISP's hostname here, or your company's domain name. |
7. | In the RECEIVING MAIL section, use the mydestination line to indicate which email needs to be delivered locally. By default, only mail addressed specifically for users on this machine have their mail delivered locally (that is, saved to a mail spool file instead of sent over the network to its destination). For example, to keep mail for the entire domain on this machine: mydestination = $myhostname,
localhost.$mydomainlocalhost
$mydomain
|
8. | In the TRUST AND RELAY CONTROL section we need to specify which hosts are allowed to relay mail through this server. The default is to authorize all clients in every subnet the system is attached to. If you're connected to the Internet, this leaves you open to abuse from spammers!Add a mynetworks line to indicate which IP addresses and networks are allowed to send mail through this system: mynetworks = 127.0.0.0/8
192.168.0.0/24
This mynetworks line authorizes the local host, plus every host on the 192.168.0.* local network. |
9. | To send mail through your ISP's SMTP server, add a relayhost line in the INTERNET OR INTRANET section specifying the ISP's server name: relayhost = smtp.your.isp.com
|
10. | Save the file and exit your text editor. |
11. | postfix checkCheck the Postfix configuration files for errors. |
12. | postfix reloadTell Postfix to reload its configuration data. You don't need to stop/start the server to make configuration changes active. |