【发布时间】:2017-05-19 16:48:21
【问题描述】:
我正在尝试发送带有附件的 HTML 电子邮件,但不工作,只是发送文件
以下代码适用于 HTML:
message="all the HTML message"
(
echo "From: UnixMail@test.com";
echo "To: emails@email.com";
echo "Subject: Testing HTML with attachment";
echo "Content-Type: text/html";
echo "MIME-Version: 1.0";
echo "";
echo "${message}";
) | /usr/sbin/sendmail -t
但我正在尝试像这样添加附件:
message="all the HTML message"
(
echo "From: UnixMail@test.com";
echo "To: emails@email.com";
echo "Subject: Testing HTML with attachment";
echo "Content-Type: text/html";
echo "MIME-Version: 1.0";
echo "Content-Transfer-Encoding: base64"
echo "Content-Type: application/octet-stream; name=test_file.txt"
echo "Content-Disposition: attachment; filename=/directory/myfile"
echo "";
echo "${message}";
) | /usr/sbin/sendmail -t
不工作,只发送没有任何可读内容的附件......有什么想法吗?
【问题讨论】:
标签: html shell unix sendmail attachment