最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

wp mail - wp_mail only sends emails to gmail

programmeradmin5浏览0评论

wp_mail only sends emails to gmail and i receive emails only on gmail inbox but in dedicated servers couldnt send recieve anything even as spam followed data works well only to gmail

        add_filter( 'wp_mail_content_type', array( $this, 'set_html_mail_content_type' ) );
       
        $to = [email protected];

        $subject = 'test';
        
        wp_mail( $to, $subject, 'body');

        remove_filter( 'wp_mail_content_type', array( $this, 'set_html_mail_content_type' ) );

wp_mail only sends emails to gmail and i receive emails only on gmail inbox but in dedicated servers couldnt send recieve anything even as spam followed data works well only to gmail

        add_filter( 'wp_mail_content_type', array( $this, 'set_html_mail_content_type' ) );
       
        $to = [email protected];

        $subject = 'test';
        
        wp_mail( $to, $subject, 'body');

        remove_filter( 'wp_mail_content_type', array( $this, 'set_html_mail_content_type' ) );

Share Improve this question asked Jul 17, 2020 at 10:41 user191790user191790 1 1
  • How have you configured WordPress to send emails? Are you using the default, which is a local SMTP server running on your WordPress server I think? How is that set up to route onward email? Is the from address you're using on a domain that's set up for SPF i.e. it is likely to be flagged as spam if it's sent from the wrong servers? – Rup Commented Jul 17, 2020 at 11:36
Add a comment  | 

1 Answer 1

Reset to default 0

Welcome to WPD stack exchange.

as I am see its look like sometimes we have forgot to add some basic need and function not working properly.

Please try with header parameter:

$headers[] = 'Content-type: text/plain; charset=utf-8';  
$headers[] = 'From:' . "[email protected]";

Also, you can use Easy WP SMTP and enable debugging and/or set that up to use SMTP. If something like GMail works then you'll know it is a server setting and not this code.

发布评论

评论列表(0)

  1. 暂无评论