命令名称:mail
使用权限:所有使用者
使用方式
[bas_rdp@BI-DB impp]$ man mail
MAIL(1) BSD General Commands Manual MAIL(1)
NAME
mail - send and receive mail
SYNOPSIS
mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr...
mail [-iInNv] -f [name]
mail [-iInNv] [-u user]
INTRODUCTION
Mail is an intelligent mail processing system, which has a command syntax reminiscent of ed(1) with lines replaced by mes-
sages.
-v Verbose mode. The details of delivery are displayed on the user鈥檚 terminal.
-i Ignore tty interrupt signals. This is particularly useful when using mail on noisy phone lines.
-I Forces mail to run in interactive mode even when input isn鈥檛 a terminal. In particular, the 鈥?[1m~鈥?special character
when sending mail is only active in interactive mode.
-n Inhibits reading /etc/mail.rc upon startup.
-N Inhibits the initial display of message headers when reading mail or editing a mail folder.
-s Specify subject on command line (only the first argument after the -s flag is used as a subject; be careful to quote
subjects containing spaces.)
-c Send carbon copies to list of users.
-b Send blind carbon copies to list. List should be a comma-separated list of names.
-f Read in the contents of your mbox (or the specified file) for processing; when you quit, mail writes undeleted mes-
sages back to this file.
-u Is equivalent to:
mail -f /var/spool/mail/user
说明:
mail 不仅只是一个指令, mail 还是一个电子邮件程序,不过利用 mail 来读信的人应该很少吧!对于系统管理者来说 mail 就很有用,因为管理者可以用 mail 写成 script. ,定期寄一些备忘录提醒系统的使用者。
参数:
i 忽略 tty 的中断讯号。 (interrupt)
I 强迫设成互动模式。 (Interactive)
v 列印出讯息,例如送信的地点、状态等等。 (verbose)
n 不读入 mail.rc 设定档。
s 邮件标题。
c cc 邮件地址。
b bcc 邮件地址。
范例:
将信件送给一个或以上的电子邮件地址,由于没有加入其他的选项,使用者必须输入标题与信件的内容等。而 user2 没有主机位置,就会送给邮件服务器的 user2 使用者。
mail user1@email.address
mail user1@email.address user2
将 mail.txt 的内容寄给 user2 同时 cc 给 user1 。如果将这一行指令设成 cronjob 就可以定时将备忘录寄给系统使用者。
mail -s 标题 -c user1 user2 < mail.txt
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/20943428/viewspace-630468/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/20943428/viewspace-630468/