Send an email that contains a HTML and plain text part
I am sending emails from my wordpress using SMTP Postman plugin. I have created a function in my functions.php file that creates a HTML registration email as per the below:
/* Custom user registration email */
function set_bp_message_content_type() {
return 'text/html';
}
add_filter( 'bp_core_signup_send_validation_email_message', 'custom_buddypress_activation_message', 10, 3 );
function custom_buddypress_activation_message( $message, $user_id, $activate_url ) {
add_filter( 'wp_mail_content_type', 'set_bp_message_content_type' );
$user = get_userdata( $user_id );
return '
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
html xmlns="http://www.w3.org/1999/xhtml"
head
meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /
titleWelcome to My Site/title
meta name="viewport" content="width=device-width, initial-scale=1.0"/
/head
body style="margin: 0; padding: 0;"
/body
/html';
}
However, many email providers check email content for both an HTML and a plain text version. My emails currently send in HTML only. Is there a way with my current setup to send a HTML and a Plain text version?
Topic html-email Wordpress
Category Web