下载:
Ubuntu 系统 heirloom-mailx 命令
安装heirloom-mailx
sudo apt-get install heirloom-mailx
CentOS安装mailx
yum -y install mailx #安装
问题:
1. hostname无效
日志报错unable to qualify my own domain name (NOD2) -- using short name
2. 发送成功却没收到邮件
解决方法:
-
针对hostname无效
修改/etc/hosts
通过hostname命令行修改hostname
-
针对阿里云服务器25端口无效
使用465端口
1、qq 企业邮箱设置 smtps 465
首先,开启 smtp
登录qq企业邮箱 ——> 设置 ——> 客户端设置
接收服务器:imap.exmail.qq.com (使用SSL,端口号993)
发送服务器:smtp.exmail.qq.com (使用SSL,端口号465)
接着,配置 /etc/mail.rc,ubuntu配置 /etc/nail.rc或 /etc/s-nail.rc
注:仔细查看/etc目录下的文件,写错文件则会失败。
vim /etc/nail.rc
1 2 3 4 5 6 7 |
|
创建证书目录
mkdir -d /root/.certs
为保证certutil命令正常运行,需安装库
apt-get install libnss3-tools
然后,ssl 授权,执行如下命令
1 2 3 4 5 |
|
附:mail常见命令
清空所有邮件
# 方法一
echo > /var/spool/mail/root
# 方法二
mail
& d 1-53
发送邮件
echo "hello word" | mail -s " title" 123456@qq.com
参考链接
https://blog.mimvp.com/article/26918.html
https://blog.mimvp.com/article/26872.html
https://www.cnblogs.com/Cong0ks/p/13401772.html
https://blog.csdn.net/weixin_34326558/article/details/92258186
https://www.runoob.com/w3cnote/centos-mail-command-sendmail.html