我正在寻找一种从 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
我怎样才能两者兼得?
谢谢
最佳答案
试试这个:
( cat body.html; uuencode in-attachfile.txt out-attachfile.txt ) | mail -s "my subject" -a "Content-Type: text/html" foo@example.com
您可能希望使用 MIME 发送附件(例如通过 mutt)。参见 this获取更多信息。
关于html - Bash:发送带有附件的 HTML?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10479340/