linux shell 发送email 附件

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.****.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

方法一:发送单个附件(正文乱码)

mutt -s "mail subject" -a output_email.html -- [email protected] < output_email.html

或者

cat output_email.html | mutt -s "mail subject" -a output_email.html -- [email protected]

效果截图:

linux shell 发送email 附件

邮件正文乱码


方法二:发送多个附件(正文不乱码)

# !/bin/shfrom='[email protected]'to='[email protected]'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

效果图:

linux shell 发送email 附件



推荐网站:

Sending files as mail attachments

Sending email with attachments on UNIX systems

Linux自动下发送HTML格式并带附件的邮件




           

给我老师的人工智能教程打call!http://blog.****.net/jiangjunshow

linux shell 发送email 附件