Contact Form notification emails contain problematic HTML tags
-
Hello. I’m reporting a problem that I ran into and was able to work around. I use a PhpMailer filter to route all WordPress wp_mail() emails through my SMTP provider (iCloud).
While WordPress and WooCommerce emails were coming through just fine, I was not receiving the majority of my Jetpack Contact Form submission notifications, though they were going into the Feedback area.
I discovered that by filtering the email body HTML through wp_kses_post() the email notifications work.
The Jetpack Contact Form email notification contains the following contents that caused the iCloud incompatibility:
<!doctype html> <html xmlns="https://www.w3.org/1999/xhtml"> <body> </body> </html>
The workaround (to auto strip the above from emails):
add_action( 'phpmailer_init', function( &$phpmailer ) { $phpmailer->Body = wp_kses_post( $phpmailer->Body ); } );
The page I need help with: [log in to see the link]
- The topic ‘Contact Form notification emails contain problematic HTML tags’ is closed to new replies.