【问题标题】:sending email from wordpress not working in server从 wordpress 发送电子邮件在服务器中不起作用
【发布时间】:2018-04-16 23:15:00
【问题描述】:

我目前正在使用 wordpress 功能发送电子邮件 wp_mail。但是当有内容类型标头时它不起作用。 我都试过了

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

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

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

【问题讨论】:

    标签: php wordpress


    【解决方案1】:

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

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

    然后调用wp_mail函数:

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

    我希望它对你有用,谢谢!

    【讨论】:

      【解决方案2】:

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

      wp plugin activate mailgun

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

      wp plugin list --status=active

      【讨论】:

        猜你喜欢
        • 2021-09-27
        • 2014-05-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-09-10
        • 2017-05-18
        • 2017-08-25
        • 1970-01-01
        相关资源
        最近更新 更多