我正在寻找一种方法来发送附加文件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)。 看到这个更多的信息。