我想通过shell脚本发送带有HTML主体和附件的邮件



执行此脚本时,我得到了一个行附件,我得到了一个空白的zip文件,但是我现有的zip文件OK OK没有任何问题。请有人帮助我解决这个问题,我尝试了很多网络,但它不起作用。

export BODY=test.html
(
echo "To:"xyz@abc.com;
echo "Subject:QC Count failed report Please find Attachment.";
echo "MIME-Version: 1.0";
echo "Content-Type:multipart/mixed; boundary="B835649000072104Jul07"";
echo "--B835649000072104Jul07";
echo "Content-Type: text/html; charset="UTF-8"";
echo "Content-Transfer-Encoding: 7bit";
echo "Content-Disposition: inline";
echo "";
echo "";
cat $BODY
echo "--B835649000072104Jul07";
echo "Content-Disposition: attachment; filename="$FAILED_ZIP"";
echo "--B835649000072104Jul07";
) | sendmail -t

使用swaks命令并连接zip?

swaks -t "abc@xyz.com" -f "noreply@example.com" --header "Subject: QC Count failed report Please find attached" --body " Here are results" --attach /path/to/the/zip/file

最新更新