I am using the below to send an email to a user each time a custom field within their profile is updated. I can output plain text into the email body using the $message line which is great. How can I adapt this so I can output html where the $message goes?
// IF CUSTOM FIELD CHANGES
function sr_user_profile_update_virtuosity( $user_id, $old_user_data ) {
$old_user_data = get_transient( 'sr_old_user_data_' . $user_id );
$user = get_userdata( $user_id );
if($old_user_data->virtuosity != $user->virtuosity) {
$admin_email = $user->user_email;
$message = sprintf( __( 'I want to output HTML here' ) ) . "\r\n\r\n";
wp_mail( $admin_email, sprintf( __( 'IMPORTANT: Your newly purchased product is ready for you' ), get_option('blogname') ), $message );
}
}
add_action( 'profile_update', 'sr_user_profile_update_virtuosity', 10, 2 );
sprintf('<html><body>%s</body></html>', 'hi mom!')PHP_EOLinstead of"\r\n"....