In order to automate the receipt of file backup information from the server, the MUTT+MSMTP is used to send e-mail in the shell environment, which is an easy and efficient way to complete operations.
Download MSMTP
wget http://downloads.sourceforge.net/msmtp/msmtp-1.4.16.tar.bz2?modtime=1217206451& Big_mirror=0
Decompression source installation 4 steps away
tar -xf msmtp-1.4. . Tar . BZ # Decompression--install GCC, which will be used to compile the installation . /configure--prefix=/usr/local/msmtpmake make andinstall
Configure MSMTP
cd/usr/local/msmtp/mkdiretc #配置文件目录和配置文件需自己建cd etc[[email protected] etc]# More/usr/local/msmtp/etc/MSMTPRC Defaults logfile/var/log/Mmlog #输出错误日志文件路径Account163#邮箱类型--here, for example, host SMTP for 163.163. com #邮箱服务器地址 from [email protected] 163. com #要从哪个邮箱发出 authLogin
User [email protected] 163#邮箱用户名 Passwordpwd#邮箱密码 (recommended to use the password that comes with the mailbox) account default:163#邮箱类型
Install Mutt and configure
Yum Install Mutt-
[email protected] etc]# cat /etc/muttrc /etc/muttrc.localset sendmail="/usr/local/msmtp/bin/ MSMTP" #msmtp命令的绝对路径set use_from=yesset realname="Root " #发件人set Editor="vim"set copy=no
Test the sender
Echo " Test " [Email protected] 163. com < /etc/hosts
"Content"--subject----the file content under absolute path
MUTT+MSMTP implementing e-mail in a shell environment