如何在电子邮件中随文件内容一起发送一些文本,不想将文件作为附件发送?是否可以通过mailx命令?
mailx -s "Email log file" abc@mail.com <$log_file;
Run Code Online (Sandbox Code Playgroud)
$log_file 内容通过电子邮件发送但下面不起作用
echo "Comment: log contains last month report" | mailx -s "Email log file" abc@mail.com < $log_file
Run Code Online (Sandbox Code Playgroud)
电子邮件中需要的输出:
Comment: Log contains last month report
<All contents of $LOG_FILE as text>
Run Code Online (Sandbox Code Playgroud)
小智 2
以下是您的操作方法:
echo "Comment: log contains last month report\n $(cat \$log_file)" | mailx -s "Email log file" abc@mail.com
Run Code Online (Sandbox Code Playgroud)
唯一“有趣”的是你必须转义文件名中的 $ 。如果需要,您还可以添加更多新行。
| 归档时间: |
|
| 查看次数: |
21524 次 |
| 最近记录: |