解决mailx发邮件报错:esmtp-server: 504 5.7.4 Unrecognized authentication type [HK2PR02CA0167.apcprd02.prod.outlook.com] "/root/dead.letter" 11/302 . . . message not sent.
报错信息:
esmtp-server: 504 5.7.4 Unrecognized authentication type [HK2PR02CA0167.apcprd02.prod.outlook.com]
"/root/dead.letter" 11/302
. . . message not sent.
背景:
由遇到的以上问题可知阿里云服务器关闭了25端口,发送邮件才会显示链接超时,而且官方不允许打开该端口,而且大部分邮件都是通过25端口
详细的可以查看:常见邮箱端口
所以除了换邮箱之外(端口不是25的,要么是国外不好申请,要么收费,我们摸摸口袋…)
言归正传,我们以网易163邮箱为例,使用SSL下的465端口。
解决方式:
一、请求数字证书:
[root@zabbix-server-center ~]# mkdir -p /root/.certs/ ###创建目录,用来存放证书
[root@zabbix-server-center ~]# echo -n | openssl s_client -connect smtp.163.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/163.crt
[root@zabbix-server-center ~]# certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt ###添加一个ssl证书到证书数据库中
[root@zabbix-server-center ~]# certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt ###添加一个Global证书到证书数据库中
[root@zabbix-server-center ~]# certutil -L -d /root/.certs ###列出目录下的数字证书
二、配置发件人:
[root@zabbix-server-center ~]# vim /etc/mail.rc
在配置文件中添加如下内容:
set from=AAA@163.com
set smtp=smtps://smtp.163.com:465
set smtp-auth-user=AAA@163.com
set smtp-auth-password=***** ###该密码是在网易邮箱中申请的第三方客户端密码,不是账户的登陆密码。
set smtp-auth=login
set ssl-verify=ignore
set nss-config-dir=/root/.certs
进入设置,找到POP3/SMTP/IMAP项,将其开启,随后会得到一个“邮箱客户端授权码”,也就是:set smtp-auth-password=邮箱客户端授权码。
三、邮箱测试:
注意有些邮箱账号必须要写全,否则收不到邮件!例如:live邮箱就必须写全才能收到邮件。但是163邮箱不用写全,就能接收到邮件。echo "hi jack,i am rose" | mail -s "zabbix" xxx@163.com
[root@zabbix-server-center .certs]# echo "hi jack,i am rose" | mail -s "zabbix" www.xxx@live.com
四、解决证书不被信任问题:
依次输入命令:
[root@zabbix-server-center ~]# cd /root/.certs/
[root@zabbix-server-center .certs]# ll
[root@zabbix-server-center .certs]# certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i 163.crt
解决问题,成功的标志:
Notice: Trust flag u is set automatically if the private key is present.
解决mailx发邮件报错:esmtp-server: 504 5.7.4 Unrecognized authentication type [HK2PR02CA0167.apcprd02.prod.outlook.com] "/root/dead.letter" 11/302 . . . message not sent.的更多相关文章
- mailx发邮件报错Error initializing NSS: Unknown error -8015. . . . message not sent.处理
前提:在配置zabbix3.0监控发送邮件告警时zabbix界面显示邮件以送达,但是QQ邮箱却没有收到邮件,再shell命令行测试发邮件QQ邮箱又是可以收到的,在别人的提醒下用zabbix用户执行发送 ...
- 关于163发邮件报错535 Error:authentication failed解决方法
关于发邮件报错535 Error:authentication failed解决方法 调用163邮箱服务器来发送邮件,我们需要开启POP3/SMTP服务,这时163邮件会让我们设置客户端授权码,这个授 ...
- 连接mysql报错 : The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone...
time zone 时区错误 DBEAVER连接MySQL运行报错The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or repres ...
- 关于发邮件报错535 Error:authentication failed解决方法
写在最前面 相信看到535报错的同学代码编写方面都没有问题,只是不明白为什么填写了帐号密码后还是报535错误,这里我以163邮箱为例,并使用Python讲解怎么解决535问题 代码如下: import ...
- AttributeError: module 'yagmail' has no attribute 'SMTP',关于使用yagmail发邮件报错的解决方法
想用yagmail,发送自动化测试结果邮件,发现运行的时候报错.最后发现是自己的脚本名称用的yagmail.py,更改成另一个就好,换了my_yagmail.py 再运行OK啦!!!!
- python smtp发邮件报错“[Errno -2] Name or service not known”的解决
最近给ss-py-mu写了个检查用户是否到期,并在到期前的第2天邮件提醒的功能. 配置存储在ini文件中,通过configparser模块获取,但尝试发送邮件的时候发现报错[Errno -2] Nam ...
- 解决MySQL报错The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents .....
1.前言 今天在用SpringBoot2.0+MyBatis+MySQL搭建项目开发环境的时候启动项目发现报了一个很奇怪的错,报错内容如下: java.sql.SQLException: The se ...
- 解决报错:The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized
Cannot create PoolableConnectionFactory (The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized . ...
- SpringBoot------连接MySQL报错:The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized
报错提示: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zon ...
随机推荐
- python scraping webs - python取得NIPS oral paper列表
from lxml import html import requests # using xpath # page = requests.get('http://econpy.pythonanywh ...
- Java多线程之synchronized和volatile
概述 用Java来开发多线程程序变得越来越常见,虽然Java提供了并发包来简化多线程程序的编写,但是我们有必要深入研究一下,才能更好的掌握这块知识. 本文主要对Java提供的底层原语synchroni ...
- 一个简易git服务器的搭建
查看本机ssh公钥,生成公钥 查看ssh公钥方法: 1. 打开git bash窗口 2. 进入.ssh目录: cd ~/.ssh 3. 找到id_rsa.pub文件: ls 4. 查看公钥:cat i ...
- C#依赖注入 简体demo
class Program { static void Main(string[] args) { Dal dal = new MySql(); dal.Add(); Dal dal1 = new ...
- double加减乘除
//四舍五入 public static double toDecimal(Double num){ if(Double.isNaN(num) || num == null){ return 0; } ...
- 归并排序 ALDS1_5_B:Merge Sort
Merge Sort Write a program of a Merge Sort algorithm implemented by the following pseudocode. You sh ...
- 题解【洛谷P3406】海底高铁
题面 比较基础的前缀和+差分. 注意开\(\text{long long}\) 直接上代码吧. #include <bits/stdc++.h> #define itn int #defi ...
- Zabbix使用手册
https://blog.csdn.net/qq_40025218/article/details/81778754
- createElement(九)
Vue.js 利用 createElement 方法创建 VNode,它定义在 src/core/vdom/create-elemenet.js 中: // wrapper function for ...
- C++ stringstream用法(转)
一直觉得C++ iostream的cout输出比起printf差了太多,今天查c++字符串拼接的时候偶然看到原来还有stringstream这个类,还是挺好用的,该类位于<sstream> ...