Postfix
Local mailserver
This example describes the installation of a postfix mailserver that just handles local mail and forwards root's mail to an external account.
Install Postfix:
# apt-get install postfix heirloom-mailx
Postfix Configuration:
- General type of mail configuration:
Internet Site
- System mail name:
server.example.org
Listen to localhost only, in /etc/postfix/main.cf
:
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
append_dot_mydomain = no
readme_directory = no
myhostname = server.example.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = server.example.com, localhost.example.com, localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
relayhost =
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = ipv4
Restart and verify:
# /etc/init.d/postfix restart
# netstat -tan
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
Set mail aliases in /etc/aliases
:
root: foo
foo: foo+root@example.net
Update alias database:
# newaliases
Test it:
# mail -s "Testmail" root
This is a test mail.
.
EOT
This should send a testmail to foo+root@example.net.