通过mutt发送邮件
在这个例子里,下面的命令将会发送一封测试邮件到john@tecmint.com。”-s”选项用于指定邮件的主题。
mutt -s "Test Email" john@tecmint.com
当你在终端里键入了上面的命令并回车后,他会打开一个确认收件人地址和主题的界面,这这里你可以修改收件人地址。
- 按t改变收件人地址
- 按c改变抄送地址
- 按a添加一个附件
- 按q退出界面
- 按y发送邮件
注意当你按了”y“界面下方将会显示发送状态。
添加抄送和密送
我们可以通过”-c”和”-b”选项添加抄送和密送。
mutt -s "Subject of mail" -c -b mail address of recipient
mutt -s “Test Email” -c tecmint.com@gmail.com -b root@server1.tecmint.com john@server1.tecmint.com
在这个例子里,用户root发送了一封邮件给john@server1.tecmint.com,抄送给了tecmint.com@gmail.com并且密送给了root@server1.tecmint.com。
发送带附件的邮件
我们可以通过”-a”选项来添加一个附件。
mutt -s "Subject of Mail" -a -c mail address of recipient
mutt -s "Site Backup" -a /backups/backup.tar -c tarunika@CentOS58server.example.com root@centos58server.example.com

在上面的截图里,你可以看到邮件的附件列表。
使用muttrc文件
如果我们想改变发送人的名字和地址,我们需要在指定的用户home目录下创建一个文件。
cat .muttrc
加入下面的行,保存退出。
set from = "user@domain.com"
set realname = "Realname of the user"
获取帮助
你可以通过”-h“选项获取”mutt“的帮助菜单。
[root@tecmint ~]# mutt -h
Mutt 1.4.2.2i (2006-07-14)
usage: mutt [ -nRyzZ ] [ -e <cmd> ] [ -F <file> ] [ -m <type> ] [ -f <file> ]
mutt [ -nx ] [ -e <cmd> ] [ -a <file> ] [ -F <file> ] [ -H <file> ]
mutt [ -i <file> ] [ -s <subj> ] [ -b <addr> ] [ -c <addr> ] <addr> [ ... ]
mutt [ -n ] [ -e <cmd> ] [ -F <file> ] -p -v[v]
options:
-a <file> attach a file to the message
-b <address> specify a blind carbon-copy (BCC) address
-c <address> specify a carbon-copy (CC) address
-e <command> specify a command to be executed after initialization
-f <file> specify which mailbox to read
-F <file> specify an alternate muttrc file
-H <file> specify a draft file to read header from
-i <file> specify a file which Mutt should include in the reply
-m <type> specify a default mailbox type
-n causes Mutt not to read the system Muttrc
-p recall a postponed message
-R mailbox in read-only mode
-s <subj> specify a subject (must be in quotes if it has spaces)
-v show version and compile-time definitions
-x simulate the mailx send mode
-y select a mailbox specified in your `mailboxes' list
-z exit immediately if there are no messages in the mailbox
-Z open the first folder with new message, exit immediately if none
-h this help message
这就是mutt的命令了,阅读mutt的man page来获取更多mutt命令信息。
