击:用一个附加文件发送HTML? [英] Bash: Sending HTML with an attached file?

查看:128
本文介绍了击:用一个附加文件发送HTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法来发送bash的HTML电子邮件与附加文件。
我试过以下行,但它不工作100%。下面的线发送的HTML电子邮件,但没有附加的文件:

I'm looking for a way to send an HTML email from bash with an attached file. I've tried the following line, but it doesn't work 100%. The below line sends an HTML email, but there is no attached file:

( 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电子邮件,然后附件如下:

If I remove the Content-Type: text/html to indicate this is an HTML email then the attachment works:

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

我怎样才能兼得?

How can I have both?

感谢您

推荐答案

试试这个:

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

您可能要发送使用MIME附件(通过狗,例如)。请参见了解详情。

You may want to send the attachment using MIME (via mutt, for example). See this for more information.

这篇关于击:用一个附加文件发送HTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆