我试着按照这里的说明:https://gist.github.com/butlerblog/7e4dbafcbc61b15505ee8ca90510f1e7
但我有点糊涂了。我不知道该在哪里通过什么论据。以下是我所拥有的:
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时,我在调试日志中得到以下错误:
[0] => SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting有什么建议吗?谢谢!
发布于 2019-01-14 19:55:13
但是,仅仅基于您发布的内容,问题是:
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服务器上电子邮件帐户的登录凭据。
如果你有一个你打算发送的电子邮件帐户,请与你的电子邮件提供商联系。他们应该能够向你提供正确的连接信息。
https://wordpress.stackexchange.com/questions/315938
复制相似问题