Email sent from WordPress has HTML tags

The default content type is ‘text/plain’ which does not allow using HTML. You can set the content type of the email by including a header like “Content-type: text/html” $headers=”Content-type: text/html;charset=utf-8″ . “\r\n”; $headers .= ‘From: XXXXXX.com <[email protected]>’ . “\r\n”; $subject=”Registration from xxxxx.com” . “\r\n”; $message = $result_email_text; wp_mail($_POST[‘admin_email’], $subject, $message, $headers ); Or you can … Read more

How to disable all WordPress emails modularly and programatically?

Option 1: Remove the ‘to’ argument from wp_mail function in WordPress, it will keep your system running without sending any default WordPress emails. add_filter(‘wp_mail’,’disabling_emails’, 10,1); function disabling_emails( $args ){ unset ( $args[‘to’] ); return $args; } The wp_mail is a wrapper for the phpmailer class and it will not send any emails if there is … Read more

Turn off admin emails for new user registrations

Function wp_new_user_notification is pluggable. It means that you can override it by declaring your version of this function in your plugin/theme. So, if you wish to disable all notifications completely, do it like this: if ( !function_exists( ‘wp_new_user_notification’ ) ) : function wp_new_user_notification( $user_id, $plaintext_pass=”” ) { return; } endif; However I wouldn’t recommend you … Read more

wp_mail – Remove sitename from email subject

Finally, I wrote some code and it worked very well. I hope it helps. Put this in your functions.php file //remove sitename from email subject add_filter(‘wp_mail’, ’email_subject_remove_sitename’); function email_subject_remove_sitename($email) { $blogname = wp_specialchars_decode(get_option(‘blogname’), ENT_QUOTES); $email[‘subject’] = str_replace(“[“.$blogname.”] – “, “”, $email[‘subject’]); $email[‘subject’] = str_replace(“[“.$blogname.”]”, “”, $email[‘subject’]); return $email; }