我正在处理在Solaris服务器上运行的KornShell(ksh)脚本,该脚本将在满足错误条件时发送电子邮件.我通过mailx发送电子邮件.
问题: 如何在mailx命令中设置"发件人"电子邮件地址?
现行代码:
echo ${msg_txt} | mailx -s "Script Failure" ${to_email}
Run Code Online (Sandbox Code Playgroud)
注意:该命令工作正常,但是,"From"是我正在运行脚本的用户的名称,我希望将其用于另一个电子邮件地址.
我怎么做到这一点?
我一直在用
mail -s "here is a log file" "person@example.com" < log/logfile.log
Run Code Online (Sandbox Code Playgroud)
过去常见的标题:
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Run Code Online (Sandbox Code Playgroud)
但现在文件更长我得到非名字附件因为这个:
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64
Run Code Online (Sandbox Code Playgroud)
所以如果一切都失败了,请查看手册man mail......
NAME
mailx - send and receive Internet mail
SYNOPSIS
mailx [-BDdEFintv~] [-s subject] [-a attachment ] [-c cc-addr] [-b bcc-addr] [-r from-addr] [-h hops]
[-A account] [-S variable[=value]] to-addr . . .
Run Code Online (Sandbox Code Playgroud)
这些选项都没有用,所以我怎么强迫Content-Type: text/plain?