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),即可發送成功啦~