I thought I had postfix setup correctly until an email was sent to root.
I created a user account “fw-mail” for mail forwarding. Using that account I created a .forward file with
$this->bbcode_second_pass_code('', 'mymail@gmail.com ')
in /home/fw-mail. In aliases I have
$this->bbcode_second_pass_code('', '
Root: fw-mail')
And I ran newaliases to update the database.
When mail is sent to root it goes to fw-mail and then is relayed to gmail.com using
$this->bbcode_second_pass_code('', 'to=<fw-mail@home.test> ')
instead of my email address. Gmail then sends me a delivery failure (as it shoud).
$this->bbcode_second_pass_code('', 'Jul 1 16:55:36 plug251 postfix/postfix-script[1277]: stopping the Postfix mail system
Jul 1 16:55:36 plug251 postfix/master[1199]: terminating on signal 15
Jul 1 16:55:39 plug251 postfix/postfix-script[1350]: starting the Postfix mail system
Jul 1 16:55:39 plug251 postfix/master[1352]: daemon started -- version 2.10.1, configuration /etc/postfix
Jul 1 16:55:54 plug251 postfix/pickup[1353]: 9ED9BC19A: uid=1001 from=<usg50>
Jul 1 16:55:54 plug251 postfix/cleanup[1360]: 9ED9BC19A: message-id=<20130701205554.9ED9BC19A@plug251.home.test>
Jul 1 16:55:54 plug251 postfix/qmgr[1354]: 9ED9BC19A: from=<usg50@home.test>, size=434, nrcpt=1 (queue active)
Jul 1 16:55:54 plug251 postfix/cleanup[1360]: C0758C199: message-id=<20130701205554.9ED9BC19A@plug251.home.test>
Jul 1 16:55:54 plug251 postfix/qmgr[1354]: C0758C199: from=<usg50@home.test>, size=568, nrcpt=1 (queue active)
Jul 1 16:55:54 plug251 postfix/local[1362]: 9ED9BC19A: to=<root@plug251.home.test>, relay=local, delay=0.26, delays=0.16/0.05/0/0.04, dsn=2.0.0, status=sent (forwarded as C0758C199)
Jul 1 16:55:54 plug251 postfix/qmgr[1354]: 9ED9BC19A: removed
Jul 1 16:55:57 plug251 postfix/smtp[1363]: C0758C199: to=<fw-mail@home.test>, orig_to=<root@plug251.home.test>, relay=smtp.gmail.com[173.194.75.108]:587, delay=2.5, delays=0.03/0.13/0.96/1.3, dsn=2.0.0, status=sent (250 2.0.0 OK 1372712157 p5sm7101490vek.1 - gsmtp)
Jul 1 16:55:57 plug251 postfix/qmgr[1354]: C0758C199: removed
[root@plug251 postfix]#')