Setting up Postfix on lino-framework.org

These are just my personal notes. No warranty whatsoever.

Quickly test whether emails are being sent:

$ echo "the body" | mail -s "the subject" my.name@gmail.com
mail.log

Consult the mail log:

$ sudo tail /var/log/mail.log
main.cf

My main.cf contains among others:

myhostname = lino-framework.org
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = lino-framework.org, vps.lino-framework.org, localhost.lino-framework.org, localhost
virtual_alias_domains = /etc/postfix/vhosts.txt
virtual_alias_maps = hash:/etc/postfix/valias.txt
  • The /etc/aliases file contains manual redirection definitions and aliases generated by mailman:

    # Required aliases
    postmaster:     root
    MAILER-DAEMON:  postmaster
    
    # Common aliases
    abuse:          postmaster
    spam:           postmaster
    
    # since 20160807
    root: luc.saffre@gmx.net
    
    
    ## mailman mailing list
    mailman:              "|/var/lib/mailman/mail/mailman post mailman"
    mailman-admin:        "|/var/lib/mailman/mail/mailman admin mailman"
    mailman-bounces:      "|/var/lib/mailman/mail/mailman bounces mailman"
    mailman-confirm:      "|/var/lib/mailman/mail/mailman confirm mailman"
    mailman-join:         "|/var/lib/mailman/mail/mailman join mailman"
    mailman-leave:        "|/var/lib/mailman/mail/mailman leave mailman"
    mailman-owner:        "|/var/lib/mailman/mail/mailman owner mailman"
    mailman-request:      "|/var/lib/mailman/mail/mailman request mailman"
    mailman-subscribe:    "|/var/lib/mailman/mail/mailman subscribe mailman"
    mailman-unsubscribe:  "|/var/lib/mailman/mail/mailman unsubscribe mailman"
    
  • The vhosts.txt file contains other domain names hosted on this server, e.g:

    saffre-rumma.net
    
  • The valias.txt file contains manual definitions of redirections from vhosts to local user names, e.g.:

    info@saffre-rumma.net luc
    webmaster@saffre-rumma.net luc
    

Restarting Postfix

$ sudo service postfix restart

The mail queue

See what’s waiting to be delivered:

$ mailq

Clear the mail queue:

$ sudo postsuper -d ALL deferred