从wordpress发送电子邮件在服务器中无法工作


sending email from wordpress not working in server

我目前正在使用wordpress功能发送电子邮件wp_mail。但是,当有Content类型的标头时,它就不起作用了。我试过两种

$headers[] = 'Content-type: text/html; charset=UTF-8';

add_filter('wp_mail_content_type','set_contenttype');
        function set_contenttype($content_type){
            return 'text/html';
        }

而且它不发送任何电子邮件。但如果我从这里删除内容类型,它会正常工作。这个问题的解决办法是什么?

尝试另一种方法将邮件内容类型设置为HTML

add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));

然后调用wp_mail函数:

wp_mail('whoever@whatever.com', 'Subject', 'Message');

我希望它对你有效,谢谢

我的Wordpress网站也遇到了同样的问题。。。我运行了这个命令来激活启用插件的插件,所以现在我收到了来自Wordpress网站的电子邮件。

wp plugin activate mailgun

检查插件是否确实使用以下命令激活。

wp plugin list --status=active