前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >linux shell 发送email 附件

linux shell 发送email 附件

作者头像
阳光岛主
发布2019-02-19 16:13:29
1.4K0
发布2019-02-19 16:13:29
举报
文章被收录于专栏:米扑专栏米扑专栏

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

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

效果截图:

邮件正文乱码

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

代码语言:javascript
复制
# !/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

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

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2011年09月16日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档