Linux 下 命令行 mail 发邮件方法

ScaNIV的头像 ScaNIV 0 2016-03-04 15:03 5

 基本信息

× 1   

浏览数: 38126

分享时间: 2 年 前

2

1. 最简单的方法:

mail -s text **@mail.ustc.edu.cn

这条命令的结果是发一封标题为text的空信给后面的邮箱,但是往往这类邮件会被当成垃圾邮件来处理,

所以如果没有收到邮件,建议打开垃圾箱来查看一下.第一种方法,你可以把当前shell当成编辑器来用,

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

2,实用的mail发送方法。

#第二种方法,使用管道命令

echo “This is a test mail!”|mail -s text **@mail.ustc.edu.cn

#第三种方法,使用重定向。

mail -s test **@mail.ustc.edu.cn < file

以file的内容为邮件内容发信,首先选择事先写好一个文档然后再mail过去。

3. 带附件的邮件发送(重点)

如果你的系统中没有uuencode命令的话,则需要先安装sharutils,

sudo apt-get install sharutils。

uuencode 需要两个参数,第一个是你要发送的文件,当然这个也可以用管道来做,第二个是显示的文件名

uuencode /home/daniel/httpd.conf httpd.conf|mail -s mailtest  **@mail.ustc.edu.cn


发送邮件带内容附件

echo "tt"|mail -a /home/pengzz/checknginx.sh -s "test" pengzezhou@social-touch.com

发送邮件带内容附件,使用mutt

sudo yum install mutt

echo "hello"|mutt -a /home/pengzz/checknginx.sh -s "subject of " -- pengzezhou@social-touch.com




12 [下一页]

  • ossaa的头像 ossaa 2018-05-09 22:53 代码数:0

    This is such a great resource that you are providing and you give it away for free. I love seeing websites that understand the value of providing a quality resource for free. It is the old what goes around comes around routine.

    small business ideas in india

  • cixexey的头像 cixexey 2018-05-21 17:42 代码数:0

    This blog is so nice to me. I will keep on coming here again and again. Visit my link as well..

    Colorado SEO services

  • cixexey的头像 cixexey 2018-05-22 18:21 代码数:0

    I am very happy to discover your post as it will become on top in my collection of favorite blogs to visit.water slide rentals Cincinnati

  • cixexey的头像 cixexey 2018-05-23 18:50 代码数:0

    Best work you have done, this online website is really cool with great facts.

    moving companies

  • cixexey的头像 cixexey 2018-05-23 20:08 代码数:0

    This is just the information I am finding everywhere. Thanks for your blog, I just subscribe your blog. This is a nice blog..Woodworking Sanders

  • cixexey的头像 cixexey 2018-05-26 22:57 代码数:0

    I have read your article, it is very informative and helpful for me.I admire the valuable information you offer in your articles. Thanks for posting it..invisalign near me

  • gererik的头像 gererik 2018-04-17 15:45 代码数:0

    Good article, but it would be better if in future you can share more about this subject. Keep posting. www.delphinehubert.com

  • cixexey的头像 cixexey 2018-05-26 23:00 代码数:0

    I have read your article, it is very informative and helpful for me.I admire the valuable information you offer in your articles. Thanks for posting it..invisalign near me

  • gererik的头像 gererik 2018-04-17 18:51 代码数:0

    This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work  www.sampostroi.com

  • sunriders的头像 sunriders 2016-09-01 22:23 代码数:0

    nice@!~

您的评论: