CentOS搭建msmtp+mutt實現郵件發送

來源:互聯網
上載者:User

標籤:msmtp   mutt   

1:搭建配置msmtp

下載msmtp包:

官方地址:http://msmtp.sourceforge.net/download.html

編譯,安裝(官方下載的包為tar.xz格式):

#xz -d msmtp-1.6.3.tar.xz#tar -xvf msmtp-1.6.3.tar#cd msmtp-1.6.3#./configure --prefix /opt/apps/msmtp#make && make install

建立並配置msmtprc檔案:

#mkdir /opt/apps/msmtp/etc#vi /opt/apps/msmtp/etc/msmtprc
# Set default values for all followingaccounts.defaultslogfile /var/log/msmtp.log# The SMTP server of the provider.account service# SMTP郵件伺服器地址host smtp.163.com#連接埠port 25# 發送的郵件Emailfrom [email protected]auth login# 郵件伺服器登入帳號user mh_chen001# 郵件伺服器登陸密碼Password password     ------------注意這裡應該配置163郵箱的用戶端授權驗證碼# Set a default accountaccount default : service

測試msmtp是否能夠發送郵件:

#/opt/apps/msmtp/bin/msmtp  [email protected]

如果能收到郵件,msmtp則正常工作。

 

2:安裝配置mutt

 安裝:

#yum -y installsharutils.x86_64

 配置mutt,修改如下配置:

#vi/etc/Muttrcsetsendmail="/opt/apps/msmtp/bin/msmtp"set use_envelope_from=yesset [email protected]setrealname="mh_chen001"set use_from=yes

 測試mutt郵件發送:(帶附件)

#echo ‘Hello!This is the statics of the Method and Method_costTime today,please check!‘ |mutt -s "Method and costTime statics" -a Method_Statistics_2015.12.22.tar.gz-- [email protected]

 查看郵件日誌:

#tail -f  /var/log/msmtp.logDec 1506:50:54 host=smtp.163.com tls=off auth=on [email protected] [email protected] mailsize=4958 smtpstatus=250smtpmsg=‘250 Mail OK queued as smtp7,C8CowEA50Fdm8nhWWf0SAA--.3655S21450766951‘ exitcode=EX_OK

 從日誌中可看到發送狀態250,郵件發送成功,登入用戶端查看郵件:

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/78/42/wKioL1Z5AjnjhhNyAAB7hurKpvw939.png" title="1.png" alt="wKioL1Z5AjnjhhNyAAB7hurKpvw939.png" />

 郵件發送正常,附件正常。


本文出自 “扮演上帝的小丑” 部落格,請務必保留此出處http://icenycmh.blog.51cto.com/4077647/1727213

CentOS搭建msmtp+mutt實現郵件發送

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.