我试图发送HTML邮件带有附件,但不工作,仅仅是发送文件如何发送HTML电子邮件附件和sendmail软件UNIX的ksh
下面的代码,是用HTML:
message="all the HTML message"
(
echo "From: [email protected]";
echo "To: [email protected]";
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: [email protected]";
echo "To: [email protected]";
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
不工作,只发送附件而不需任何可读的东西...任何想法?