大自然的小精灵

导航

 
Mutt Description: 
Mutt is a small but very powerful text based program for reading and sending electronic mail under unix operating systems,
including support for color terminals, MIME, OpenPGP, and a threaded sorting mode.

语法:

mutt [-hnpRvxz][-a<文件>][-b<地址>][-c<地址>][-f<邮件文件>][-F<配置文件>][-H<邮件草稿>][-i<文件>][-m<类型>][-s<主题>][邮件地址]

选项:

-a file [...] 在邮件中加上附件。
Attach a file to your message using MIME.  
When attaching single or multiple files, separating filenames and recipient addresses with  "--" is mandatory, 
e.g. mutt -a image.jpg -- addr1 or mutt -a img.jpg *.png -- addr1 addr2.	
The -a option must  be	placed at the end of command line options.
-A alias An expanded version of the given alias is passed to stdout. -b address Specify a blind-carbon-copy (BCC) recipient.   指定密件副本的收信人地址。
-c address Specify a carbon-copy (CC) recipient.   指定副本的收信人地址。 -d level If mutt was compiled with +DEBUG log debugging output to ~/.muttdebug0.             Level can range from 1-5 and effects verbosity. A value of 2 is recommended. -D Print the value of all configuration options to stdout.
-e command Specify a configuration command to be run after processing of initialization files.      指定处理初始化文件后要运行的配置命令。 -E Causes the draft file specified by -H or include file specified by -i to be edited during message composition.
-f mailbox Specify which mailbox to load. 指定要加载的邮箱。 -F muttrc Specify an initialization file to read instead of ~/.muttrc. 指定mutt程序的初始化文件,而不读取预设的.muttrc文件。
-h         Display help.
-H draft   Specify a draft file which contains header and body to use to send a message.
          指定草稿文件,其中包含用于发送消息的标题和正文。
-i include Specify a file to include into the body of a message.
          将指定文件插入邮件内文中。
-m type Specify a default mailbox type for newly created folders.   指定预设的邮件信箱类型。 -n Causes Mutt to bypass the system configuration file.   让Mutt不要去读取系统配置文件(/etc/Muttrc)。
-p         Resume a postponed message.
          在mutt中编辑完邮件后,而不想将邮件立即送出,可将该邮件暂缓寄出。
-Q query   Query a configuration variables value. 
           The query is executed after all configuration files have been parsed, 
       and any commands given on the command line have been executed.
-R Open a mailbox in read-only mode.   以只读的方式开启邮件文件。 -s subject Specify the subject of the message.   指定邮件的主题。
-v         Display the Mutt version number and compile-time definitions.
          显示mutt的版本信息以及当初编译此文件时所给予的参数。
-vv        Display license and copyright information.
-x Emulate the mailx compose mode.   模拟mailx的编辑方式。 -y Start Mutt with a listing of all mailboxes specified by the mailboxes command.
-z When used with -f, causes Mutt not to start if there are no messages in the mailbox.   与-f参数一并使用时,若邮件文件中没有邮件即不启动mutt。 -Z Causes Mutt to open the first mailbox specified by the mailboxes command which contains new mail.
-- Treat remaining arguments as addr even if they start with a dash.
Mutt官网:http://www.mutt.org

举例说明(发送与以下程序email_image.sh在同一个文件夹下的图片到指定邮箱):

#!/bin/bash

for File in "$@"
do
    read -p "Address to e-mail this image to? " Address
    read -p "Message to accompany image? " Message
    echo "$Message" | mutt -s "This is a test." -a "$File" -- "$Address"
    echo "$File sent to $Address"

在命令行输入以下代码运行程序:

#先赋予文件执行权限
chmod 755 email_image.sh
#执行此文件,加上想发送的图片作为命令行参数
./email_image.sh image1_name image2_name

#按照提示,输入想发送的邮件地址(Address)以及邮件正文内容(Message),即可发送成功啦~

 


posted on 2019-06-19 16:07  Bella1102  阅读(1099)  评论(0编辑  收藏  举报