我需要从具有 HTML 内容类型的 linux 主机发送邮件,并将文件附加到邮件中。
cat html_mail.txt
To: me@mydomain.com
Subject: Test Mail
Content-Type: text/html; charset="us-ascii"
Content-Disposition: inline
<span style="background-color:green">This is in green</span>
我尝试了以下选项:
mail:
mail -a attachment_file < html_mail.txt
“mail”命令发送附件,但 html_mail.txt 中的 HTML 内容在邮件中以纯文本形式出现
Execution of the command says "Ignoring headers Content-Type".
sendmail:
cat html_mail.txt |sendmail -t
sendmail sends the html content properly, but I couldn't find an option to send an attachment.