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:
- The expected forwarded email
- The following message from
[email protected]
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 [email protected]
auth on
user me
password xxxxxxxxxxxxxxxx
account default : gmail
aliases /etc/aliases
Here are my system aliases
# /etc/aliases
default: [email protected]
How do I make sure that only the first email reaches me? For example, can msmtp rewrite root@backupbox as [email protected]?