Joe*_*ham 54 linux email redhat
有没有人知道如何在使用mail命令发送电子邮件时更改用户?我查看了手册页,看不清楚如何做到这一点.
我们正在运行Redhat Linux 5.
dan*_*els 67
您可以使用-a指定任何额外的标头
$mail -s "Some random subject" -a "From: some@mail.tld" to@mail.tld
Run Code Online (Sandbox Code Playgroud)
Pao*_*ino 28
http://www.mindspill.org/962似乎有一个解决方案.
实质上:
echo "This is the main body of the mail" | mail -s "Subject of the Email" recipent_address@example.com -- -f from_user@example.com
bfa*_*bry 21
mail -r from@from.from -R from@from.com
-r = from-addr -R =回复地址
作者表示他的邮件版本不支持此标志.但是,如果你有一个版本,这可以正常工作.
G.J*_*G.J 18
通过SMTP发送时,mail手册页建议以from这种方式设置变量(在CentOS 6上测试):
mail -s Subject -S from=sender@example.com recipient@example.com
Run Code Online (Sandbox Code Playgroud)
您还可以使用以下-a选项附加文件:
mail -s Subject -S from=sender@example.com -a path_to_attachement recipient@example.com
Run Code Online (Sandbox Code Playgroud)
您可以通过首先添加 -- 将 sendmail 选项附加到邮件命令的末尾。-f 是 sendmail 上设置发件人地址的命令。所以你可以这样做:
邮件收件人@foo.com -- -f sender@bar.com
这些都不适用于我(Ubuntu 12.04),但最后通过试验和错误我得到了:
echo 'my message blabla\nSecond line (optional of course)' |
mail -s "Your message title"
-r 'Your full name<yourSenderAdress@yourDomain.abc>'
-Sreplyto="yourReplyAdressIfDifferent@domain.abc"
destinatorEmail@destDomain.abc[,otherDestinator@otherDomain.abc]
Run Code Online (Sandbox Code Playgroud)
(全部在一行中,"-Sreplyto"中没有空格)
我收到了这封邮件命令:
apt-get install mailutils
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
175404 次 |
| 最近记录: |