Simple Installation and Configuration of Postfix on Debian
Installing and Configuring Postfix on Debian
1.- Install postfix (this will remove exim since there can't be two mail systems). (If you have a website, choose "Internet Site" if the configuration prompts ask for it.):
$ apt-get install postfix
2.- Check the log mail.log, mail.err, mail.info, mail.warn to see if postfix runs.
$ cat /var/log/mail.log
3.- Add your domain to the config files, so others can't abuse your mailsystem:
$ postconf -e "myorigin = example.com"
4.- Add your hostname (computer name). (Use command "hostname" at the command-line to display your hostname if not sure.)
$ postconf -e "myhostname=server1.example.com"
5.- Now add the domain names that your system will handle.
$ postconf -e "relay_domains = example.com, example2.com, example3.com"
6.- Reload Postfix Server:
$ postfix reload
7.- Test the mailserver. Type:
$ telnet localhost 25
8.- You should see:
Trying 127.0.0.1... Connected to localhost.localdomain. Escape character is '^]'. 220 server1.example.com ESMTP Postfix (Debian/GNU)
9.- Send an email to yourself:
rcpt to: data To: email@example.com From: firstname.lastname@example.org Subject: Hey my first email This is my first email on debian postfix after installing configuring it. It was easy.
10.- To end data hit enter, type in a dot, and hit enter again:
You're done. Type "mail" in the command-line terminal and see if you have some. Now let's go to the next step:
- If you have a router with firewall, enable port 25 and forward that port to your computer.
- Enter your MX records in your domain provider. (e.g. godaddy.com or dnspark.com). Check your mx records: go to ip tools and locate "DNS lookup". From pulldown menu select "MX". Type in your domain name (ex. example.com). You should see some records there. If you don't see any MX records go back to previous step. You have to have MX record otherwise other computers won't be able to see you when sending emails.
1. qshape 2. mailq 3. qshape deferred 4. postsuper 5. postsuper -r ALL (requeue all emails)
You should be set. If your isp is blocking the traffic then you might need to login to their smtp services.
anti-spam: smtp restrictions
The first fight starts at your server so this should be added to any email server that you setup. This makes sure that any computer that tries to send an email to you has a valid domain name. (spammers use ex. myhomepc as a domain name. This will stop them from spamming you.)
- Insert this in your
smtpd_recipient_restrictions = reject_invalid_hostname, reject_unknown_recipient_domain, reject_unauth_destination, reject_rbl_client sbl.spamhaus.org, permit smtpd_helo_restrictions = reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname, reject_unknown_helo_hostname
anti-spam: Using RBL Lists
RBL list is a list of domains which says whether they are spammers or not.
- Insert this in your
smtpd_client_restrictions = reject_rbl_client dnsbl.sorbs.net
Debian Anti-Spam Anti-Virus Gateway Email Server
If you are building anti spam system that will act as a gateway. Read below. If you want to add more anti-spam restrictions this is worth reading. Take a look at Debian Anti-Spam Anti-Virus Gateway Email Server