Wp_mail Wordpress Html With Style Not Aplying
I'm trying to send mail from my wordpress plugin but when I retrieve it, it has not styles or images. I'm doing this way:
Solution 1:
It could be better if you put the code how did you use wp_mail_content_type
You should filter content type before call wp_mail() For example:
add_filter('wp_mail_content_type', function($content_type) {
return'text/html';
});
wp_mail( 'me@example.net', 'The subject', '<div>The message</div>' );
Solution 2:
Try adding
add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));
Seems by default wp_mail()
returns text/plain
content.
You can use WordPress’s wp_mail() function to send emails from your WordPress site. However, the default content type is ‘text/plain’ which does not allow using HTML. If you want to send HTML emails then you will need to set the content type of the email to “text/html” by using the ‘wp_mail_content_type’ filter.
Source: How to Send HTML Emails From WordPress
Edit
Issue seems to be related to mail client rendering of HTML content.
Post a Comment for "Wp_mail Wordpress Html With Style Not Aplying"