[英]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.