0

我正在寻找一种从 bash 发送带有附件的 HTML 电子邮件的方法。我已经尝试了以下行,但它不能 100% 工作。以下行发送了一封 HTML 电子邮件,但没有附加文件:

( cat body.html ; uuencode in-attachfile.txt out-attachfile.txt ) | mail -s "$(echo -e "my subject\nContent-Type: text/html")" foo@example.com

如果我删除Content-Type: text/html以表明这是一封 HTML 电子邮件,则附件有效:

( cat body.html ; uuencode in-attachfile.txt out-attachfile.txt ) | mail -s "$(echo -e "my subject")" foo@example.com

我怎么能两者兼得?

谢谢

4

1 回答 1

2

尝试这个:

( cat body.html; uuencode in-attachfile.txt out-attachfile.txt ) | mail -s "my subject" -a "Content-Type: text/html" foo@example.com

您可能希望使用 MIME 发送附件(例如,通过 mutt)。有关更多信息,请参阅

于 2012-05-07T09:32:16.260 回答