先建立好postfix能發信的環境
安裝套件yum -y install mutt
yum安裝的請注意 如果是1.4版以下的不支援content_type變數無法使用html寄信
1.4版會出現 “指令行有错:content_type:不明的变量”
可以到官網下載最新的tar包來安裝
http://www.mutt.org/
ftp://ftp.mutt.org/pub/mutt/
wget ftp://ftp.mutt.org/pub/mutt/mutt-1.5.24.tar.gz tar zcvf mutt-1.5.24.tar.gz cd mutt-1.5.24 ./configure make && make install ln -s /usr/local/bin/mutt /usr/bin/
檢查版本mutt -v
修改系統環境變量
vi /etc/sysconfig/i18n LANG="zh_CN.UTF-8" SYSFONT="latarcyrheb-sun16"
修改個人帳號環境變量
vi .bashrc LANG="zh_CN.UTF-8" SYSFONT="latarcyrheb-sun16" vi .muttrc 請依照你的環境修改參數 set from = "[email protected]" set realname = "您的名字" set imap_user = "[email protected]" set imap_pass = "password" set folder = "imaps://imap.gmail.com:993" set spoolfile = "+INBOX" set postponed ="+[Gmail]/Drafts" set header_cache =~/.mutt/cache/headers set message_cachedir =~/.mutt/cache/bodies set certificate_file =~/.mutt/certificates set smtp_url = "smtp://[email protected]:587/" set smtp_pass = "password" set move = no set imap_keepalive = 900
建立mutt寄信用shell
mkdir mutt
abc.txt -----文章內文
mail.txt-----收件者信箱
mail-txt.sh------mutt寄信純文字
mail-html.sh------mutt寄信html格式
vi mail-txt.sh
#純文字寄信 #!/bin/sh i=1 while read rad do cat abc.txt | mutt -s "測試Groups send a message" $rad echo no.$i #counter ((i+=1)) done < mail.txt
vi mail-html.sh
#!/bin/sh i=1 while read rad do cat abc.txt | mutt -s "測試Groups send a message" -e "set content_type=text/html" $rad echo no.$i #counter ((i+=1)) done < mail.txt
abc.txt 裡面就可以貼上 html 語法
查看q住的信
mailq
mailq
強制刪除背景的信
postsuper -d ALL
http://www.ahlinux.com/shell/4394.htmlhttp://iplaylinux.com/check-mutt-version.htmlhttp://blog.xuite.net/tolarku/blog/58439089-Postfix+Mail+Queue+-+%E4%B8%80%E4%BA%9B%E7%B0%A1%E5%96%AE%E7%9A%84%E7%AE%A1%E7%90%86%E6%8C%87%E4%BB%A4
Hits: 327