4

WordPress发送邮件很慢的解决方法

 2 years ago
source link: https://xushanxiang.com/2022/03/wordpress-slow-mail-solution.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

WordPress发送邮件很慢的解决方法

作者: xusx 分类: 其它 发布时间: 2022-03-21 21:22

WordPress使用 smtp 方式测试发送邮件没有问题,应该是 sendmail 函数发送邮件慢的问题了。此时可以输入如下命令(Linux环境):

cat /etc/hosts

查看到解析文件如下(第三行的是服务器内部ip和阿里云服务器的主机名,涉及服务器,我已经随意修改其中个别数字。):

127.0.0.1 localhost
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.160.39.89 iZ89ro6yu9aZ

因为sendmail监听的是127.0.0.1,但却无法确认主机名 iZ89ro6yu9aZ。

而在服务器上/etc/sysconfig/network文件里记录的HOSTNAME是 iZ89ro6yu9aZ ,所以发送邮件就非常慢了。

那么我就把 iZ25ro4yu9aZ 这个主机名同时也加到127.0.0.1上面,变成:

127.0.0.1 localhost
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 iZ89ro6yu9aZ
10.160.39.89 iZ89ro6yu9aZ

有的人说 还需要重启sendmail服务:service sendmail restart,实际上不是必须的。

如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK