linux发送邮件的功能总结

今天添加了发送邮件的功能,总结一下,供以后参考:

1、直接使用管道发送邮件

echo "hello,this is the content of mail.welcome to www.mzone.cc" | mail -s "Hello from mzone.cc by pipe" admin@qunar.com

2、使用文本发送

mail -s "Hello from mzone.cc by file" admin@qunar.com < mail.txt

3、如果希望修改发送邮件的人,那么:

mail -s "title" -r "from@qunar.com" to@qunar.com

4、如果想要发送附件,那么:

echo "" | mutt -s "邮件名称" qiu.li@qunar.com -c 抄送邮件列表 -a 附件路径

如果发送csv文件,很可能出现乱码,那么需要提前将文件转码,命令是:

/usr/bin/iconv -t gb2312 -f utf-8 -c 源文件名 > 目标文件名
  • -t 目标编码
  • -f 原来编码

 

posted @ 2014-07-08 21:47  李秋  阅读(538)  评论(0编辑  收藏  举报