centos 使用mailx 发送邮件

73 阅读1分钟

centos 使用 mailx发送邮件方法

yum install mailx

配置

vi /etc/mail.rc

# 设置网易邮箱的SMTP服务器
set smtp="smtps://smtp.163.com"
# 设置使用SSL加密
#set smtp-use-starttls
set smtp-auth=login
# 你的网易邮箱地址
set smtp-auth-user="noodzhan@163.com"
# 你的网易邮箱授权码
set smtp-auth-password="xxxxxx"
# 设置发件人邮箱地址
set from="noodzhan@163.com"
# 开启SSL加密
set ssl-verify=ignore

网易授权码

需要登录网易邮箱,设置里面开通SMTP服务,然后生成授权码。

image.png

发送邮件

echo "hello world" | mailx -s "test" noodzhan@163.com