欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Shell腳本實現(xiàn)自動發(fā)送郵件的例子

 更新時間:2014年08月29日 11:54:13   投稿:junjie  
這篇文章主要介紹了Shell腳本實現(xiàn)自動發(fā)送郵件的例子,使用.muttrc文件配合shell腳本實現(xiàn),需要的朋友可以參考下

1、編輯用戶Home目錄下的.muttrc文件,設(shè)置發(fā)信環(huán)境。

復(fù)制代碼 代碼如下:

# cat /root/.muttrc
set envelope_from=yes
set from=owinux@sina.cn
set realname="Owinux"
set use_from=yes
set rfc2047_parameters=yes
set charset="utf-8"

2、發(fā)信腳本

復(fù)制代碼 代碼如下:

# cat automail.sh
#!/bin/sh
# automail.sh
DIR=/root/owinux
mailcontent=$DIR/mailcontent
> "$mailcontent"
echo -e "owinux,您好!\n" >> $mailcontent
echo -e "\t附件為 `date +%Y-%m-%d` 設(shè)備日檢報告,敬請查收。" >> $mailcontent
cat mailcontent | /usr/bin/mutt -s "設(shè)備日檢報告" -a /root/owinux/report.xls owinux@126.com -c owinux@yeah.net -c owinux@sina.com

3、簡要說明:
 
-s:指定主題
-a:附件
-c:抄送,需要抄送多人的話,須使用多個 -c 選項
 
使用上面的發(fā)信環(huán)境可以保證在頁面查看郵件的時候,附件名不出現(xiàn)亂碼。
其中 .muttrc 的 "set from"可以隨便設(shè)置,可以是不存在的郵箱地址,當(dāng)然正確的最好。
比如:

復(fù)制代碼 代碼如下:

set from=abc@owinux.com

不過也并不是你設(shè)置的正確的郵箱地址就一定能發(fā)送成功。

復(fù)制代碼 代碼如下:

set from=owinux@126.com

我新注冊了一個 owinux@126.com,然后將 set from 設(shè)置為owinux@126.com,就沒有成功。
原因在于126郵箱報了 550 MI:SPF 錯誤,連接到126 企業(yè)退信的常見問題? 發(fā)現(xiàn)

復(fù)制代碼 代碼如下:

550 MI:SPF 發(fā)信IP未被發(fā)送域的SPF許可。 

相關(guān)文章

最新評論