使用bash更改sendmail发件人

时间:2011-09-15 20:15:36

标签: bash sendmail

运行sendmail命令我通常收到发件人的电子邮件,如username@hostname

有没有办法使用sendmail发送电子邮件,并将发件人设置为与用于运行命令的用户帐户不同的内容?

1 个答案:

答案 0 :(得分:33)

您要找的是-f

sendmail -F "Your name" -f "your-address@example.com" < your-message.txt

来自sendmail man page

 -Ffullname  Set the full name of the sender.

 -fname      Sets the name of the ``from'' person (i.e., the sender of the
             mail).  -f can only be used by ``trusted'' users (normally
             root, daemon, and network) or if the person you are trying to
             become is the same as the person you are.