非root 用戶 mutt+msmtp linux 發送郵件

CentOS release 6.6 (Final)

yum -y install msmtp mutt

mutt 配置文件/etc/Muttrc  /etc/Muttrc.local


非ROOT配置方式:

不使用默認配置文件, 新建下列文件:

[root@vm work]# more .Muttrc 
set sendmail="/usr/bin/msmtp"   #msmtp路徑
set use_from=yes
set realname="yjyygywcw"       #發件人
set editor="vim"
set from="[email protected]"   #發件郵箱
set envelope_from=yes

[root@vm work]# more .msmtprc 
account default
host smtp.163.com                #你的發送郵件服務器 
port 25
from [email protected]
auth login#這裏如果使用on的話會報 "msmtp: cannot use a secure authentication method"錯誤
tls off
user [email protected]
password kaiwangxiao
logfile /opt/log/msmtp.log
from [email protected]

[root@vm work]# chmod 600 .Muttrc .msmtprc

測試
echo "testmail" | mutt -F ~/.Muttrc -s "測試"  [email protected] -a /etc/hosts 
mutt -F ~/.Muttrc -s "測試" -a /etc/hosts -a /etc/apple [email protected] < /var/log/maillog


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章