Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Email Postfix与office365集成,用于发送电子邮件_Email_Office365_Postfix - Fatal编程技术网

Email Postfix与office365集成,用于发送电子邮件

Email Postfix与office365集成,用于发送电子邮件,email,office365,postfix,Email,Office365,Postfix,我有一台CentOS7服务器,将部署到客户站点。我想在服务器出现问题时通过电子邮件获得警报 我有一个office365帐户,所以我正在考虑是否可以将其用作SMTP中继服务器。(如果我的话没有意义,请原谅我,因为我对SMTP和电子邮件相关技术的了解非常有限) 我的第一个问题是,我是否需要对office365帐户执行任何特殊操作?我正在使用smtp.office365.com:587作为smtp中继主机 这是我的postfix main.cf配置: relayhost = [smtp.office3

我有一台CentOS7服务器,将部署到客户站点。我想在服务器出现问题时通过电子邮件获得警报

我有一个office365帐户,所以我正在考虑是否可以将其用作SMTP中继服务器。(如果我的话没有意义,请原谅我,因为我对SMTP和电子邮件相关技术的了解非常有限)

我的第一个问题是,我是否需要对office365帐户执行任何特殊操作?我正在使用smtp.office365.com:587作为smtp中继主机

这是我的postfix main.cf配置:

relayhost = [smtp.office365.com]:587
smtp_always_send_ehlo = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_generic_maps = hash:/etc/postfix/generic
smtp_tls_security_level = may
smtp_sasl_security_options = noanonymous
这是我的“generic”和“sasl_passwd”文件的样子。我还使用了“postmap”来生成.db文件

/.*/    <o365 email>
root@server.difan.local <o365 email>
root@localdomain        <o365 email>
@localdomain            <o365 email>

[smtp.office365.com]:587 <o365 email>:<o365 password>
下面是我在/var/log/maillog中看到的内容

Mar 26 10:46:00 server postfix/pickup[1921]: 5DC594087202: uid=0 from=<root>
Mar 26 10:46:00 server postfix/cleanup[2495]: 5DC594087202: message-id=<20170326164600.5DC594087202@server.difan.local>
Mar 26 10:46:00 server postfix/qmgr[1922]: 5DC594087202: from=<root@server.difan.local>, size=486, nrcpt=1 (queue active)
Mar 26 10:46:00 server postfix/smtp[2497]: warning: SASL authentication failure: No worthy mechs found
Mar 26 10:46:00 server postfix/smtp[2497]: 5DC594087202: SASL authentication failed; cannot authenticate to server smtp.office365.com[40.97.128.34]: no mechanism available
... <last two messages repeated 4 times>
Mar 26 10:46:02 server postfix/smtp[2497]: 5DC594087202: to=<difan.zhao@outlook.com>, relay=smtp.office365.com[40.97.142.194]:587, delay=2.2, delays=0.02/0/2.2/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server smtp.office365.com[40.97.142.194]: no mechanism available)
Mar 26 10:46:00服务器后缀/拾取[1921]:5DC594087202:uid=0 from=
3月26日10:46:00服务器后缀/清理[2495]:5DC594087202:消息id=
3月26日10:46:00服务器后缀/qmgr[1922]:5DC594087202:from=,size=486,nrcpt=1(队列活动)
3月26日10:46:00服务器后缀/smtp[2497]:警告:SASL身份验证失败:未找到有价值的机制
3月26日10:46:00服务器后缀/smtp[2497]:5DC594087202:SASL身份验证失败;无法对服务器smtp.office365.com[40.97.128.34]进行身份验证:无可用机制
... 
3月26日10:46:02服务器后缀/smtp[2497]:5DC594087202:to=,relay=smtp.office365.com[40.97.142.194]:587,delay=2.2,delays=0.02/0/2.2/0,dsn=4.7.0,status=deferred(SASL身份验证失败;无法验证到服务器smtp.office365.com[40.97.142.194]:无可用机制)

我哪里做错了?谢谢

首先将通用文件更改为:

/.*/    email@domain.com
其次,验证您的通用和sasl权限: 设置所有者和权限

sudo postmap hash:/etc/postfix/generic 
sudo chown root:root /etc/postfix/generic /etc/postfix/generic.db  
sudo chmod 644 /etc/postfix/generic /etc/postfix/generic.db  

sasl\u passwd
db
文件相同。

首先将通用文件更改为:

/.*/    email@domain.com
其次,验证您的通用和sasl权限: 设置所有者和权限

sudo postmap hash:/etc/postfix/generic 
sudo chown root:root /etc/postfix/generic /etc/postfix/generic.db  
sudo chmod 644 /etc/postfix/generic /etc/postfix/generic.db  

sasl\u passwd
db
文件相同。

我必须安装这些。。。不知道他们是什么,但他们成功了


yum安装cyrus sasl cyrus sasl lib cyrus sasl plain

我必须安装这些。。。不知道他们是什么,但他们成功了


yum安装cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain

在新版本的Ubuntu/Debian上,您需要安装此软件包:libsasl2模块

apt install libsasl2-modules
然后重新加载后缀

systemctl reload postfix

在新版本的Ubuntu/Debian上,您需要安装以下软件包:libsasl2模块

apt install libsasl2-modules
然后重新加载后缀

systemctl reload postfix

嘿,谢谢你的建议。。我最后不得不安装这些:yum安装cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain。不知道它们是什么,但它现在起作用了!嘿,谢谢你的建议。。我最后不得不安装这些:yum安装cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain。不知道它们是什么,但它现在起作用了!为了让你的答案更有用,你应该解释你在做什么以及为什么它起作用;此外,你还可以使用格式使你的答案更具可读性。为了使你的答案更有用,你应该解释你在做什么以及为什么它起作用;此外,您还可以使用格式使答案更具可读性。