欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

Unbuntu 20.04 安装并配置 heirloom-mailx 使用外部 smtp 发送邮件

最编程 2024-07-11 17:26:40
...

安装

1.     添加heirloom-mailx apt源

vim /etc/apt/sources.list  #最后添加

deb http://cz.archive.ubuntu.com/ubuntuxenial main universe


2.     更新apt

apt update


3.     安装heirloom-mailx

apt install heirloom-mailx -y


配置

1.     配置外部发件邮箱

vim /etc/s-nail.rc 最后添加以下内容

set from= xxxx@xxxxx.com     #发件箱地址
set smtp=smtp.126.com # smtp服务器
set smtp-auth-user= xxxx@xxxxx.com #登录发件地址
set smtp-auth-password=123456 #登录发件密码(明文)
set smtp-auth=login #登录方式
set smtp-use-starttls #加密方式
set ssl-verify=ignore #忽略ssl认证

2.     测试

echo '测试邮件'|s-nail -s 'cesi' ​​​xxxx@xxxx.com​

Unbuntu20.04 安装配置heirloom-mailx使用外部smtp发送邮件_hive

3.     发送带附件邮件

echo '内容' |s-nail -s '主题' -a 附件 -c 抄送邮件地址   收件人邮件地址,收件人邮件地址