Sample Header Ad - 728x90

Can msmtp rewrite addresses?

8 votes
1 answer
1608 views
I am trying to get all my system emails to be forwarded to my gmail address, using msmtp 1.8.3 and /etc/aliases on debian. It works, but I get errors from gmail. When I email root (via echo "hello world" | mail -s "forward me" root), I obtain 2 emails in the inbox of the gmail address: 1. The expected forwarded email 2. The following message from mailer-daemon@googlemail.com
Address not found
Your message wasn't delivered to root@backupbox because the domain backupbox couldn't be found. Check for typos or unnecessary spaces and try again.
The response was:

DNS Error: 5452395 DNS type 'mx' lookup of backupbox responded with code NXDOMAIN Domain name not found: backupbox
Obviously, it is not surprising that gmail cannot reach root@backupbox, since from their perspective, backupbox is not a fully qualified domain name. I am however surprised, because I aliased all my system addresses to my gmail address. Here is my msmtp configuration: # /etc/msmtprc defaults port 587 tls on tls_trust_file /etc/ssl/certs/ca-certificates.crt account gmail host smtp.gmail.com from me@gmail.com auth on user me password xxxxxxxxxxxxxxxx account default : gmail aliases /etc/aliases Here are my system aliases # /etc/aliases default: me+backupbox@gmail.com How do I make sure that only the first email reaches me? For example, can msmtp rewrite root@backupbox as me@gmail.com?
Asked by user48678 (209 rep)
Dec 5, 2019, 10:55 PM
Last activity: Sep 16, 2021, 11:22 AM