[英]Attach image in the email body using mail or mailx in Bash
我想使用shell脚本中的mail
或mailx
在电子邮件正文中附加图像。 mutt
和sendmail
实用程序不可用,我没有权限安装它们。
uuencode
也不可用
首先,我尝试使用mailx使用以下命令发送HTML内容,但它没有用。 它只是将带有html标签的原始数据发送到邮件
export body="<html><header><title>This is title</title></header><body>Hello world</body></html>"
echo $body | mailx -S "MIME-Version: 1.0" -S "Content-Type: text/html" -vvv -s "test mail" -r sender@xx.com reciever@yy.com
我尝试使用选项-a附加标题,但它没有用,因为-a用于附件
并且还尝试使用以下命令,它只是附加图像而在身体中不可见。
mailx -s "test mail" -r sender@xx.com reciever@yy.com < Capture.PNG
任何人都可以帮助我以正确的方式发送带有图片的电子邮件
发送附件的一种可能方法是使用如下命令:
uuencode Capture.PNG Capture.PNG|mailx -s "test mail" -r sender@xx.com reciever@yy.com
最简单的答案:
mail -s "the subject" -a attachment.xyz you@email.com < body.txt
如果这不适合您,请使用multipart MIME。 以Stack Exchange上的这篇文章为例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.