用以下方法可以实现:(前提:mutt 必须在1.5版本以上,我用的1.5.21)
cat index.html |/usr/local/mutt/bin/mutt -s “test” -e ‘set content_type=“text/html”’ tian.zhiying@163.com
另外:mutt还可以发送带附件的邮件
echo "this is test " |/usr/local/mutt/bin/mutt -s “test” tian.zhiying@163.com -a /root/extman.2.11.tar.gz
在文件的当前文件夹下,ls 可以看到该文件
mutt 1234@qq.com -s “标题” -a 文件名
执行命令后,会让你编辑邮件,回车,回车,最后小写y发送邮件
也可以指定发件人(默认是root):
使用参数 -e “my_hdr from:tian.zhiying@163.com”
总的来说就是以下一条命令:
cat index.html |/usr/local/mutt/bin/mutt -s “test” -e “my_hdr from:tian.zhiying@163.com” -e ‘set content_type=“text/html”’ tian.zhiying@163.com -a /root/extmail-1.0.1.tar.gz