我有这个以root身份运行的脚本,当它无法执行某些操作时,需要使用postfix(实际上是Centos5上的常规邮件命令)发送邮件。
问题是电子邮件中的“来自”用户是“根”,我该如何将其更改为另一个用户?
由于您使用的是后缀,因此请使用后缀sendmail插件:
echo "this is the mail" | sendmail -F "Bogus User" -f [email protected] [email protected]
您始终可以在系统上创build一个新用户,然后使用该用户运行“mail”命令:
su foo -c "echo blabla | mail foo@bar"