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
1 Answer
Reset to default 0Welcome 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.