网站的邮箱问题和启用插件变慢问题

首先是邮箱问题,默认WordPress使用phpmailer进行邮件发送,界面不会显示任何信息,包括错误信息,用了一些插件才能看到。

然后我发现了提示的错误是

PHPMailer Debug: Could not instantiate mail function.

一搜就有结果,更深入地,是官方的说明文档

官方回答

If you also see the message More than one “from” person, it’s likely that your php.ini’s sendmail_path property already contains a -f parameter, and so your code is trying to add a second envelope sender, which is not allowed.

  • Ideally, use isSMTP() and send directly using SMTP; it’s faster, safer, and easier to debug than using mail().
  • Install a local mail server (e.g. postfix).
  • Ensure that your sendmail_path points at the sendmail binary (usually /usr/sbin/sendmail) in your php.ini. Note that on Ubuntu/Debian you may have multiple .ini files in /etc/php5/mods-available and possibly other locations.
  • Use isSendmail() and set the path to the sendmail binary in PHPMailer ($mail->Sendmail = ‘/usr/sbin/sendmail’;). It’s very unlikely this option is appropriate; evaluate other solutions first.

This means that your PHP installation is not configured to call the mail() function correctly (e.g. sendmail_path is not set correctly in your php.ini), or you have no local mail server installed and configured. To fix this you need to do one or more of these things (in order of preference):

要设置SMTP的话得去修改主题文件的fuction.php,我暂时没弄,直接搞第二条,装了个postfix。使用本地模式,设置好之后使用邮件测试工具确实能通过测试了,但是邮箱完全没收到邮件。

后面我通过WP Maill SMTP这个插件,先将系统的发件地址改为国内的邮箱,再将管理员邮箱也改了,然后确认邮箱,修改成功。

其他smtp插件好像会要求两个必须是一致的才能发邮件,也有可能是我的端口没选对,反正WP Mail SMTP是没问题的。

然后在该插件的其他选项里勾上完全移除。装其他普通smtp插件,简单配置即可。

之所以要删除WP Mail SMTP,是因为这个插件有太多功能要收费了,虽然都不是我需要的(邮件记录是我需要的),但是看着很碍眼。再者是之前跟着这个插件的官方教程配置邮箱,结果网站直接卡成几分钟反应一下。后面知道了是因为配置的国外邮箱,国内服务器访问特别慢而且很难成功才导致的,但是给我造成的伤害真的太多了。其他插件的邮件记录功能可以直接免费用。

那个时候真的,一启动这个插件就卡,明明已经卸载重装了。我还以为插件乱修改文件,把网站给弄坏了。😭后面才发现是一启动就加载之前遗留的配置,不停尝试连接国外邮箱。

所以上面说到卸载之前要先勾选完全移除的选项。


评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注