我試圖發送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
不工作,只發送附件而不需任何可讀的東西...任何想法?