首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何配置SMTP服务器?

如何配置SMTP服务器?
EN

WordPress Development用户
提问于 2018-10-04 22:29:06
回答 1查看 1.4K关注 0票数 0

我试着按照这里的说明:https://gist.github.com/butlerblog/7e4dbafcbc61b15505ee8ca90510f1e7

但我有点糊涂了。我不知道该在哪里通过什么论据。以下是我所拥有的:

代码语言:javascript
复制
define( 'SMTP_USER',   'mylogin@login.ca' );    // The email address I use when I log in to the wp-admin page
define( 'SMTP_PASS',   '123password' );       // The password I use when I log in to the wp-admin page
define( 'SMTP_HOST',   'localhost' );    // I am testing this on localhost
define( 'SMTP_FROM',   'mylogin@login.ca' ); // Also the email address I use for logging in on the wp-admin page
define( 'SMTP_NAME',   'My Site Name' );    // SMTP From name
define( 'SMTP_PORT',   '25' );                  // SMTP port number - likely to be 25, 465 or 587
define( 'SMTP_SECURE', 'tls' );                 // Encryption system to use - ssl or tls
define( 'SMTP_AUTH',    true );                 // Use SMTP authentication (true|false)
define( 'SMTP_DEBUG',   1 );                    // for debugging purposes only set to 1 or 2

我很确定我没有发送正确的东西。当我尝试使用wp_mail时,我在调试日志中得到以下错误:

代码语言:javascript
复制
[0] => SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

有什么建议吗?谢谢!

EN

回答 1

WordPress Development用户

发布于 2019-01-14 19:55:13

但是,仅仅基于您发布的内容,问题是:

代码语言:javascript
复制
define( 'SMTP_USER',   'mylogin@login.ca' );    // The email address I use when I log in to the wp-admin page
define( 'SMTP_PASS',   '123password' );       // The password I use when I log in to the wp-admin page
define( 'SMTP_HOST',   'localhost' );    // I am testing this on localhost
define( 'SMTP_FROM',   'mylogin@login.ca' ); // Also the email address I use for logging in on the wp-admin page

您发布的脚本是定义到SMTP服务器的连接信息。除非您在本地主机上使用其他常量定义中提供的登录凭据实际运行SMTP服务器,否则这就是脚本失败的原因。

SMTP_HOST常量必须定义要连接到的SMTP电子邮件服务器的位置(如

同样,登录信息不应该是用于登录到WordPress的信息。您在注释中指出,这些是登录凭据,您可以使用这些凭据登录wp-admin。但它们应该是您连接到的SMTP服务器上电子邮件帐户的登录凭据。

如果你有一个你打算发送的电子邮件帐户,请与你的电子邮件提供商联系。他们应该能够向你提供正确的连接信息。

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

https://wordpress.stackexchange.com/questions/315938

复制
相关文章

相似问题

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