系统之家 - 系统光盘下载网站!

当前位置:系统之家 > 系统教程 > linux中mail命令

通过实例了解Linux mail命令的作用(2)

时间:2014-12-22 17:05:43 作者:qipeng 来源:系统之家 1. 扫描二维码随时看资讯 2. 请使用手机浏览器访问: https://m.xitongzhijia.net/xtjc/20141222/33142.html 手机查看 评论

  在这里要说明一下的时,如果我们的附件是不大的文本文件,我们有时也用不着发送附件,可以直接将附件的文本当做邮件内容发送,这样通过邮件查看时也更方便些,如下:

  代码如下:

  mail -s “this is a test” bbmonkey62@163.com 《 /home/hadoop/project/3.txt

  3、不用回车输入邮件内容发送邮件

  在上面的例子中,你如果照做的话,你会发现很不方便,那就是每次输入邮件内容都需要在命令运行后回车输入内容,最后还要再按Ctrl+D完成。实际上,可以不用这么费劲的,如下:

  代码如下:

  echo “this is content” | mail -s “this is a title” bbmonkey62@163.com

  通过echo命令来输入邮件内容“this is content”,这样就简单多了!

  4、查看邮件

  通过mail命令也可以查看收到的邮件,这个我就简单说一下吧,毕竟这个相对不常用,命令很简单,直接输入mail,会出现收到的邮件,每个邮件都对应一个序列号,如果要查看某封邮件,直接在?后输入数字序列号即可。

  在?后输入help可以查看所有的参数,如下:

  代码如下:

  ? help

  mail commands

  type 《message list》 type messages

  next goto and type next message

  from 《message list》 give head lines of messages

  headers print out active message headers

  delete 《message list》 delete messages

  undelete 《message list》 undelete messages

  save 《message list》 folder append messages to folder and mark as saved

  copy 《message list》 folder append messages to folder without marking them

  write 《message list》 file append message texts to file, save attachments

  preserve 《message list》 keep incoming messages in mailbox even if saved

  Reply 《message list》 reply to message senders

  reply 《message list》 reply to message senders and all recipients

  mail addresses mail to specific recipients

  file folder change to another folder

  quit quit and apply changes to folder

  xit quit and discard changes made to folder

  ! shell escape

  cd 《directory》 chdir to directory or home if none given

  list list names of all available commands《/p》 《p》A 《message list》 consists of integers, ranges of same, or other criteria

  separated by spaces. If omitted, mail uses the last message typed.

  在?后也可以直接输入mail写信哦,就跟上面的例子一样,所不同的是,每步都会有提示,如下:

  代码如下:

  ? mail

  To: bbmonkey62@163.com

  Subject: this is a title

  content

  EOT

  上面就是Linux中mail命令的用法介绍了,其实mail命令的用法还有很多,本文只是介绍了一些主要的用法,mail还可作为一个电子邮件程式,不过使用的人比较少。

发表评论

0

没有更多评论了

评论就这些咯,让大家也知道你的独特见解

立即评论

以上留言仅代表用户个人观点,不代表系统之家立场

其他版本软件

热门教程

人气教程排行

Linux系统推荐

扫码关注
扫码关注

扫码关注 官方交流群 软件收录