co.de.mon.key

Weblog

Own mailserver - Debian 7 Wheezy VPS - Part 1 - basic mailserver

| Comments

Check / set up machine’s hostname

1
2
malpka@codemonkey:~$ hostname
codemonkey.pl

Set up DNS record

1
2
@  IN MX  1  codemonkey.pl
@  IN TXT "v=spf1 a mx ~all"

Check SMTP (25) port for outside availability

Install postfix

1
apt-get install postfix

Voila! ;)

Check if we have access to mail command

1
apt-get install mailutils

and send the mail (end with Ctrl+D)

Mail received, post reply

After posting the reply

Configure mail aliases

In /etc/aliases file we can add redirections between local users

1
2
3
codemonkey:~# tail -n 1 /etc/aliases
root: malpka
codemonkey:~# newaliases

Remarks

  • be aware of STMP relay security! SMTPD_ACCESS_README.html
  • works for any local system user
  • uses /var/mail/{username} as a default mailbox location and MBox as a format
  • mail servers like gmail will reject e-mails from our mailserver until the RevDNS and SPF record are properly configured.

Comments