一.环境
系统 CentOS 6.4x64最小化安装
二.安装msmtp
#下载软件包 [[email protected] ~]# wget http://sourceforge.net/projects/msmtp/files/msmtp/1.4.30/msmtp-1.4.30.tar.bz2/download [[email protected] ~]# tar xf msmtp-1.4.30.tar.bz2 [[email protected] ~]# cd msmtp-1.4.30 [[email protected] msmtp-1.4.30]# ./configure --prefix=/usr/local/msmtp [[email protected] msmtp-1.4.30]# make && make install
创建配置文件
[[email protected] ~]# mkdir /usr/local/msmtp/etc [[email protected] ~]# cat /usr/local/msmtp/etc/msmtprc account default host smtp.163.com #发件箱邮件服务器地址 port 25 from [email protected] #从哪个邮箱发出 auth login tls off user [email protected] password aisin_gioro logfile /var/log/mmlog
三.安装mutt
[[email protected] ~]# yum install mutt -y #编辑配置文件 [[email protected] ~]# vim /etc/Muttrc set sendmail="/usr/local/msmtp/bin/msmtp" set use_from=yes set realname="[email protected]" set editor="vim"
测试
[[email protected] ~]# echo "testmail" | mutt -s "ceshi" [email protected] [[email protected] ~]# echo "ceshi" |mutt -s "hello" [email protected] -a /etc/fstab #这里的-a 是指添加附件,如果是多个附件的话就 多加几个 -a 文件名
时间: 2024-10-05 05:49:45