linux发送邮件的功能,总结一下,供以后参考:
1、直接使用管道发送邮件
echo
"hello,this is the content of mail.welcome to www.example.com" | mail -s "Hello from mzone.cc by pipe" xiong@tuniu.com
2、使用文本发送
mail -s
"Hello from example.com by file" xiong@tuniu.com < mail.txt
3、如果希望修改发送邮件的人,那么:
mail -s "title" -r "from@tuniu.com" xiong@tuniu.com
4、如果想要发送附件,那么:
echo "" | mutt -s "邮件名称" xiong@tuniu.com -c 抄送邮件列表 -a 附件路径
如果发送csv文件,很可能出现乱码,那么需要提前将文件转码,命令是:
/usr/bin/iconv -t gb2312 -f utf-
8 -c 源文件名 > 目标文件名
-t 目标编码-f 原来编码
转载于:https://www.cnblogs.com/shujuxiong/p/11220626.html