以前也写过mutt+msmtp sendmail的文章,现在重新写一次吧。
1.download msmtp software
直接输入如下地址,可以获得software
http://sourceforge.net/projects/msmtp/files/msmtp/1.4.31/msmtp-1.4.31.tar.bz2/download
2.install msmtp
[root@oracle6 opt]# tar -xvf msmtp-1.4.31.tar.bz2
[root@oracle6 opt]# cd msmtp-1.4.31
[root@oracle6 msmtp-1.4.31]# ./configure --prefix=/opt/msmtp --with-ssl=openssl
[root@oracle6 msmtp-1.4.31]# make
[root@oracle6 msmtp-1.4.31]# make install
3.配置配置文件
[root@oracle6 etc]# pwd
/opt/msmtp/etc
[root@oracle6 etc]# more msmtprc
account default
host smtp.163.com
port 25
from tolilong@163.com
auth login
tls off
user tolilong@163.com
password xxxxxx
logfile /var/log/mmlog
[root@oracle6 ~]# more /etc/Muttrc
set from="tolilong@163.com"
set sendmail="/opt/msmtp/bin/msmtp"
set use_from=yes
set realname="SystemInfo"
set editor="vi"
4.sendmail
[root@oracle6 ~]# echo "Log" | mutt -s "Log Info" -a /root/install.log.syslog tolilong@163.com
[root@oracle6 ~]# cat install.log.syslog | mutt -s "Log Info" -a /root/install.log.syslog tolilong@163.com
[root@oracle6 ~]# cat install.log.syslog | mutt -s "Log Info" -a /root/install.log.syslog tolilong@163.com,bruce_xxxx@163.com
-s=subject(主题)
-a=attachment(附件)
多个maillist中间用逗号","分开
*******************************************************************
[root@oracle6 ~]# cat install.log.syslog | mutt -s "Log Info" -a test tolilong@163.com
Can't stat tolilong@163.com: No such file or directory
tolilong@163.com: unable to attach file.
遇到如上一个问题,即发送带附件的mail的时候报了如上这个错误。
将mail list放到 -a 参数即可以。
[root@oracle6 ~]# cat install.log.syslog | mutt -s "Log Info" tolilong@163.com -a test
[root@oracle6 ~]# cat install.log.syslog | mutt -s "Log Info" tolilong@163.com,bruce_xxxxx@163.com -a /root/install.log.syslog
*******************************************************************
1.download msmtp software
直接输入如下地址,可以获得software
http://sourceforge.net/projects/msmtp/files/msmtp/1.4.31/msmtp-1.4.31.tar.bz2/download
2.install msmtp
[root@oracle6 opt]# tar -xvf msmtp-1.4.31.tar.bz2
[root@oracle6 opt]# cd msmtp-1.4.31
[root@oracle6 msmtp-1.4.31]# ./configure --prefix=/opt/msmtp --with-ssl=openssl
[root@oracle6 msmtp-1.4.31]# make
[root@oracle6 msmtp-1.4.31]# make install
3.配置配置文件
[root@oracle6 etc]# pwd
/opt/msmtp/etc
[root@oracle6 etc]# more msmtprc
account default
host smtp.163.com
port 25
from tolilong@163.com
auth login
tls off
user tolilong@163.com
password xxxxxx
logfile /var/log/mmlog
[root@oracle6 ~]# more /etc/Muttrc
set from="tolilong@163.com"
set sendmail="/opt/msmtp/bin/msmtp"
set use_from=yes
set realname="SystemInfo"
set editor="vi"
4.sendmail
[root@oracle6 ~]# echo "Log" | mutt -s "Log Info" -a /root/install.log.syslog tolilong@163.com
[root@oracle6 ~]# cat install.log.syslog | mutt -s "Log Info" -a /root/install.log.syslog tolilong@163.com
[root@oracle6 ~]# cat install.log.syslog | mutt -s "Log Info" -a /root/install.log.syslog tolilong@163.com,bruce_xxxx@163.com
-s=subject(主题)
-a=attachment(附件)
多个maillist中间用逗号","分开
*******************************************************************
[root@oracle6 ~]# cat install.log.syslog | mutt -s "Log Info" -a test tolilong@163.com
Can't stat tolilong@163.com: No such file or directory
tolilong@163.com: unable to attach file.
遇到如上一个问题,即发送带附件的mail的时候报了如上这个错误。
将mail list放到 -a 参数即可以。
[root@oracle6 ~]# cat install.log.syslog | mutt -s "Log Info" tolilong@163.com -a test
[root@oracle6 ~]# cat install.log.syslog | mutt -s "Log Info" tolilong@163.com,bruce_xxxxx@163.com -a /root/install.log.syslog
*******************************************************************
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24237320/viewspace-2040198/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/24237320/viewspace-2040198/