• Resolved Sean Conklin

    (@seanconklin)


    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 );
    
    } );
    • This topic was modified 1 year, 4 months ago by Sean Conklin.
    • This topic was modified 1 year, 4 months ago by Sean Conklin.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Animesh Gaurav (a11n)

    (@bizanimesh)

    Hi Sean – I tested the contact form submission, and the emails are landing correctly in my email inbox. Could you please confirm when you mentioned you are not getting notifications?

    Do you mean those emails are not getting landed in your email inbox, but you can check them in the Feedback area in the WP Admin dashboard?

    Thread Starter Sean Conklin

    (@seanconklin)

    Hi @bizanimesh, yes without my code snippet active I receive the Feedback entry but the notification email never comes. With my code snippet active, I receive both the Feedback entry and the notification email.

    By stripping out the above stated HTML tags from the email body the email comes through. I suspect this is an iCloud mail server compatibility. I also suspect the problem to be the first tag DOCTYPE since HTML and BODY tags are quite common in emails.

    Plugin Support Animesh Gaurav (a11n)

    (@bizanimesh)

    Hello there!

    I suspect this is an iCloud mail server compatibility.

    Is this issue happening only with iCloud Mail?

    I noticed you mentioned you are using iCloud for SMTP. Is that correct? Our many users use below two SMTP, and it works well for them, so could you please try one of them?

    Plugin Support Tamirat B. (a11n)

    (@tamirat22)

    Hello @seanconklin

    Do you have updates about that? We usually close inactive threads after one week of no activity, but we want to make sure we’re all set before marking it as solved. Thanks!

    Thread Starter Sean Conklin

    (@seanconklin)

    Marking as solved with my workaround (see original report).

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Contact Form notification emails contain problematic HTML tags’ is closed to new replies.