方法一:发送单个附件(正文乱码)
mutt -s "mail subject" -a output_email.html -- tomail@163.com < output_email.html
或者
cat output_email.html | mutt -s "mail subject" -a output_email.html -- tomail@163.com
效果截图:

邮件正文乱码
方法二:发送多个附件(正文不乱码)
# !/bin/sh
from='yanggang@fruitsmobile.com'
to='yanggang_2050@163.com'
email_date=''
email_subject='subjest'
email_content="./folder/file"
email_attach="./folder/file ./folder/file2 ./folder/file3 ./folder/file4"
function send_email(){
email_date=$(date "+%Y-%m-%d_%H:%M:%S")
email_subject=$email_subject"__"$email_date
cat $email_content | /usr/bin/mutt -s $email_subject -a $email_attach -e 'set content_type="text/html"' -e 'my_hdr from:'$from -- $to
}
send_email
效果图:

推荐网站:
Sending files as mail attachments
Sending email with attachments on UNIX systems
本文详细介绍了如何使用Mutt命令行工具发送HTML格式的邮件,并附带附件的方法,包括两种常见的情况:发送单个附件时可能出现正文乱码的问题及解决办法,以及发送多个附件时正文不乱码的操作步骤。
2896

被折叠的 条评论
为什么被折叠?



