Linux 命令行 发送邮件

1、mail -s hi xx@yy.com

      给xx@yy.com发一封主题为hi的信(没有正文)

      编辑完内容后Ctrl-D结束。

2、echo “This is a test mail!”|mail -s hi xx@yy.com

      xx@yy.com发一封主题为hi的信(正文是This is a test mail!

3、mail -s hi xx@yy.com < file
      以file的内容为邮件内容发信,首先选择事先写好一个文档然后再mail过去。
4、带附件的邮件发送
      4.1 如果你的系统中没有uuencode命令的话,则需要先安装sharutils(sudo apt-get install sharutils)

      4.2 uuencode myfile myfile|mail -s hi  xx@yy.com

            其中myfile就是要添加的附件

posted on 2014-08-17 15:22  EXLsunshine  阅读(221)  评论(0编辑  收藏  举报