第一步:下载解压包
1 | wget http://ftp.debian.org/debian/pool/main/h/heirloom-mailx/heirloom-mailx_12.5.orig.tar.gz |
第二步:解压缩
1 | tar zxvf heirloom-mailx_12.5.orig.tar.gz |
第三步:跳转到解压缩目录下
第四步:编译安装
1 | make && make install UCBINSTALL=/usr/bin/install |
第五步:编辑配置文件
1 | vi /etc/mail.rc |
第六步:配置发送邮件信息
1 | vi /etc/mail.rc |
在配置文件的最后添加如下代码:
1 2 3 4 5 6 | # 配置发送邮件的信息 set [email protected] #(需修改)和第三行邮箱地址保持一致 set smtp="smtp.qq.com" #(需修改)所使用的外部邮箱的smtp服务器地址 set smtp-auth-user="[email protected]" #(需修改)所使用的外部邮箱的用户名 set smtp-auth-password="admin" #(需修改)授权码 set smtp-auth="login" |
遇到问题:
发送邮件遇到问题
1 | send-mail: fatal: parameter inet_interfaces: no local interface found for ::1 |
解决:
1 | vi /etc/postfix/main.cf |
如果是要在阿里云的远程服务器上发送邮件,上面的配置就不能成功,因为25端口不能使用。所以需要借助其他手段:https://blog.csdn.net/qq_42859864/article/details/84862977
可以输入命令进行测试:
1 | echo "test" | mail -s "test" [email protected] #这里填写收件人的邮箱 |
发送成功就可以在邮箱看到成功的邮件,否则没有成功。
关于mial的操作可以参考:https://www.cnblogs.com/xiangsikai/p/8441195.html