Friday, August 07, 2015

forwarding mail with changed sender/from address

Sometimes I want to relay cron mails over an external mail server. In this cases the mail is delivered faster if I set the FROM to the real address that corresponds to the smtp credentials.

all mails to root are forwarded to alex@other-domain.com
But the FROM is changed to alex@strato-mail-account.de

# cat /etc/mail/aliases
...
root: mycron
mycron: "|/usr/bin/mail -s 'Cron <root@example.com>' -r alex@strato-mail-account.de alex@other-domain.com"
...

# newaliases



# cat /etc/mail/smtpd.conf
...
table secrets db:/etc/mail/secrets.db

accept from local for local alias <aliases> deliver to maildir
accept from local for any relay via tls+auth://label@smtp.strato.de auth <secrets>
...

No comments: