大多数人在尝试正确伪造电子邮件的发件人地址时需要更改两个值。第一个是发件人地址,第二个是原始地址。许多在线提供的解决方案只改变了其中一个值。
如果以 root 身份,我尝试一个简单的邮件命令给自己发送一封电子邮件,它可能看起来像这样。
echo "test" | mail -s "a test" me@noone.com
以及相关的日志:
Feb 6 09:02:51 myserver postfix/qmgr[28875]: B10322269D: from=<root@myserver.com>, size=437, nrcpt=1 (queue active)
Feb 6 09:02:52 myserver postfix/smtp[19848]: B10322269D: to=<me@noone.com>, relay=myMTA[x.x.x.x]:25, delay=0.34, delays=0.1/0/0.11/0.13, dsn=2.0.0, status=sent (250 Ok 0000014b5f678593-a0e399ef-a801-4655-ad6b-19864a220f38-000000)
尝试使用 -- 更改发件人地址
echo "test" | mail -s "a test" me@noone.com -- dude@thisguy.com
这会更改 orig-to 值,但不会更改 from 值:
Feb 6 09:09:09 myserver postfix/qmgr[28875]: 6BD362269D: from=<root@myserver.com>, size=474, nrcpt=2 (queue active)
Feb 6 09:09:09 myserver postfix/smtp[20505]: 6BD362269D: to=<me@noone>, orig_to=<dude@thisguy.com>, relay=myMTA[x.x.x.x]:25, delay=0.31, delays=0.06/0/0.09/0.15, dsn=2.0.0, status=sent (250 Ok 0000014b5f6d48e2-a98b70be-fb02-44e0-8eb3-e4f5b1820265-000000)
接下来尝试使用 -r 和 -- 来调整 from 和 orig-to。
echo "test" | mail -s "a test" -r dude@comeguy.com me@noone.com -- dude@someguy.com
还有日志:
Feb 6 09:17:11 myserver postfix/qmgr[28875]: E3B972264C: from=<dude@someguy.com>, size=459, nrcpt=2 (queue active)
Feb 6 09:17:11 myserver postfix/smtp[21559]: E3B972264C: to=<me@noone.com>, orig_to=<dude@someguy.com>, relay=myMTA[x.x.x.x]:25, delay=1.1, delays=0.56/0.24/0.11/0.17, dsn=2.0.0, status=sent (250 Ok 0000014b5f74a2c0-c06709f0-4e8d-4d7e-9abf-dbcea2bee2ea-000000)
这就是它对我的工作方式。希望这对某人有所帮助。