DMA (Dragonfly Mail Agent)

# ansible role
https://github.com/panticz/ansible/tree/master/roles/dma

# preconfigure
echo "dma dma/relayhost string mail.example.com" | debconf-set-selections
echo "dma dma/mailname string $(hostname -f)" | debconf-set-selections
 
# install
apt-get install -y dma
 
# configure relayhost
echo "user|smarthost:password" >> /etc/dma/auth.conf
 
# send testmail
echo "This is a test message from ${USER}@$(hostname -f) at $(date)" | /usr/sbin/sendmail foo@exaple.com

Configuration files

# /etc/dma/dma.conf
AUTHPATH /etc/dma/auth.conf
SMARTHOST smtp.example.de
PORT 587
MAILNAME example.com
MASQUERADE foo@example.com
SECURETRANSFER
STARTTLS
 
# /etc/dma/auth.conf
foo@example.com|smtp.example.com:pass1234

view log

journalctl _COMM=sendmail -f

Fix on wheezy

echo "deb http://archive.debian.org/debian squeeze main" > /etc/apt/sources.list.d/squeeze.list
apt-get update

Cleanup domain not found

for MAIL in $(grep "Domain not found" /var/log/mail.log | cut -d"<" -f2 | cut -d">" -f1 | sort -u); do
    for FILE in $(grep -l ${MAIL} /var/spool -r); do
        rm ${FILE}
    done
done

Links
https://wiki.mageia.org/en/Dma_Dragonfly_Mail_Agent