首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SMTP错误:无法连接到SMTP主机

SMTP错误:无法连接到SMTP主机
EN

Drupal用户
提问于 2018-04-03 16:18:12
回答 2查看 2.8K关注 0票数 0

我们有一个新的Drupal 8网站和有问题的SMTP模块。我们用来发送电子邮件的帐户在我们的Drupal 7站点和其他情况下成功地工作,但是我们不能让它在Drupal 8上成功地工作。我还尝试了另一个非SSL帐户,并且在错误日志中一次又一次地收到相同的两条消息。

从smtp@website.com发送电子邮件到email@email.com: SMTP错误:无法连接到SMTP主机。发送电子邮件时出错(从smtp@website.com发送到email@email.com并回复-不设置)。

我发现了许多类似的问题,但尚未找到可行的解决办法。任何帮助都将不胜感激,谢谢您的提前!

EN

回答 2

Drupal用户

回答已采纳

发布于 2018-04-03 17:22:35

哈!事实证明,这不是Drupal问题,而是SELinux的Centos问题。通过运行以下命令,我能够检查SELinx设置

getsebool httpd_can_sendmail

又回来了

httpd_can_sendmail --> off

getsebool httpd_can_network_connect

返回

httpd_can_network_connect --> off

我通过运行以下命令启用了它们

柴胡醇-P httpd_can_sendmail 1 -P httpd_can_network_connect 1

在那之后,Drupal模块工作得很好。希望这对其他人也有帮助。

票数 1
EN

Drupal用户

发布于 2020-06-29 16:02:36

对于Drupal 8,请安装PHPMailer和SMTP:转到您的Drupal 8项目的根目录并执行下面的操作,以便从Admin接口或通过drush安装并启用smtp模块。

代码语言:javascript
复制
composer require phpmailer/phpmailer
composer require drupal/smtp

配置SMTP : /admin/config/system/smtp

安装选项

代码语言:javascript
复制
Set SMTP as the default mailsystem

On
When on, all mail is passed through the SMTP module.

SMTP服务器设置

SMTP服务器

代码语言:javascript
复制
smtp.host.name
The address of your outgoing SMTP server.

SMTP备份服务器

传出SMTP备份服务器的地址。如果找不到主服务器,就会尝试这个服务器。这是可选的。

SMTP端口

代码语言:javascript
复制
25
The default SMTP port is 25, if that is being blocked try 80. Gmail uses 465. See 
http://gmail.google.com/support/bin/answer.py?answer=13287 for more information on 
configuring for use with Gmail.

使用加密协议

代码语言:javascript
复制
No
This allows connection to an SMTP server that requires SSL encryption such as Gmail.

自动启用TLS加密

代码语言:javascript
复制
On
Whether to enable TLS encryption automatically if a server supports it, even if the 
protocol is not set to "tls".

超时

代码语言:javascript
复制
60
Amount of seconds for the SMTP commands to timeout.

Turn on the SMTP keep alive feature
Enabling this option will keep the SMTP connection open instead of it being openned 
and then closed for each mail

SMTP认证

如果SMTP服务器不需要身份验证,则保留空白。

用户名

SMTP用户名。

密码

SMTP密码

如果您以前已输入密码,则应将此字段保留为空白,除非要更改存储的密码。请注意,此密码将以纯文本形式存储在Drupal的核心配置变量中。

电子邮件选项

代码语言:javascript
复制
E-mail from address
The e-mail address that all e-mails will be from.

E-mail from name
The name that all e-mails will be from. If left blank will use a default of: Portal 
Name . Some providers (such as Office365) may ignore this field. For more 
information, please check SMTP module documentation and your email provider 
documentation.

允许发送格式为HTML的电子邮件

代码语言:javascript
复制
Checking this box will allow HTML formatted e-mails to be sent with the SMTP protocol.

SMTP客户端设置

主机名

代码语言:javascript
复制
noreply@domain.com
The hostname to use in the Message-Id and Received headers, and as the default HELO 
string. Leave blank for using _.

海洛

代码语言:javascript
复制
Test
The SMTP HELO/EHLO of the message. Defaults to hostname (see above).

发送测试电子邮件

代码语言:javascript
复制
E-mail address to send a test e-mail to
Type in an address to have a test e-mail sent there.

启用调试

选中此框将打印SMTP消息。

启用调试将有助于了解SMTP isssues,请检查项目页中是否有其他错误参考:https://www.drupal.org/project/smtp

票数 0
EN
页面原文内容由Drupal提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://drupal.stackexchange.com/questions/259083

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档