centos7发送邮件

yum install mailx -y

 

vi /etc/mail.rc

set hold
set append
set ask
set crt
set dot
set keep
set emptybox
set indentprefix="> "
set quote
set sendcharsets=iso-8859-1,utf-8
set showname
set showto
set newmail=nopoll
set autocollapse
ignore mime-version content-transfer-encoding
fwdretain subject date from to

set bsdcompat

#以下为新加的配置
set from=xxx@qq.com

set smtp=smtp.qq.com:25

set smtp-auth-user=xxx@qq.com

set smtp-auth-password=授权码

set smtp-auth=login

 

测试

echo "abc测试" | mail -s "主题" 收件人邮箱

如遇乱码请再百度

posted @ 2020-12-21 15:31  --鲲鹏展翅--  阅读(134)  评论(0编辑  收藏  举报