前置条件:开启邮箱的 POP3/SMTP/IMAP 服务
1.修改/etc/mail.rc
vim /etc/mail.rc在文件尾部添加这些内容
设置126邮箱
set from=“邮箱账号”@126.com set smtp=smtp.126.com set smtp-auth-user=“邮箱账号”@126.com set smtp-auth-password=“代理授权码” set smtp-auth=loginset from=“邮箱账号”@126.com set smtp=smtp.126.com set smtp-auth-user=“邮箱账号”@126.com set smtp-auth-password=“代理授权码” set smtp-auth=login
设置163邮箱
set from=“邮箱账号”@163.com set smtp=smtp.163.com set smtp-auth-user=“邮箱账号”@163.com set smtp-auth-password=“代理授权码” set smtp-auth=loginset from=“邮箱账号”@163.com set smtp=smtp.163.com set smtp-auth-user=“邮箱账号”@163.com set smtp-auth-password=“代理授权码” set smtp-auth=login
2.设置完成后 重启邮件
systemctl restart postfix systemctl restart mailxsystemctl restart postfix systemctl restart mailx
3.向邮箱发送测试邮件
echo "测试文字"| mail -s "邮件主题" “邮箱账号”@qq.com echo "测试文字"| mail -s "邮件主题" “邮箱账号”@126.comecho "测试文字"| mail -s "邮件主题" “邮箱账号”@qq.com echo "测试文字"| mail -s "邮件主题" “邮箱账号”@126.com 4.登录邮箱查看接受的邮件