1: Build ConfigurationMsmtp
Download msmtp Package:
official address:http://msmtp.sourceforge.net/download.html
Compile, install ( the official download package is in tar.xz format ):
#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
To Create and configure the MSMTPRC file:
#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 mail server address host smtp.163.com# port 25# send mail emailfrom [email protected]auth login# mail server login account user mh_chen001# Mail Server login Password Password Password------------Note You should configure the client auth code for 163 mailbox # Set a default Accountaccount default:service
test whether msmtp can send mail:
#/opt/apps/msmtp/bin/msmtp [email protected]
If you can receive the email,msmtp will work properly.
2: Installation ConfigurationMutt
Installation:
#yum-y installsharutils.x86_64
To Configure Mutt, modify the following configuration:
#vi/etc/muttrcsetsendmail= "/OPT/APPS/MSMTP/BIN/MSMTP" set use_envelope_from=yesset [email protected]setrealname=] mh_chen001 "Set Use_from=yes
Test Mutt Mail send: (with attachments)
#echo ' hello! This is the statics of the method and Method_costtime today,please check! ' |mutt-s "method and Costtime statics"-A Metho d_statistics_2015.12.22.tar.gz--[email protected]
To view the Mail log:
#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= ' + Mail OK queued as SMTP7,C8COWEA50FDM8NHWWF0SAA--. 3655s21450766951 ' EXITCODE=EX_OK
from the log, you can see the sending status , e-mail sent successfully, log in to the client to view the message:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/78/42/wKioL1Z5AjnjhhNyAAB7hurKpvw939.png "title=" 1.png " alt= "Wkiol1z5ajnjhhnyaab7hurkpvw939.png"/>
Mail is sent normally, attachment is normal.
This article is from "The Clown who plays God" blog, please make sure to keep this source http://icenycmh.blog.51cto.com/4077647/1727213
CentOS build Msmtp+mutt for email delivery