• Hi Hannes, simple and easy to reproduce bug. I set my site name to “Eric’s Site” and then when WP HTML Mail sends messages, the apostrophie is encoded as HTML… i.e. the from address is “Eric, ampersand, hanshtag, 039, semicolon, s Site” (ironically I can’t type it here on the www.ads-software.com editor or else it just fixes it.)

    Here is a screenshot showing the problem: https://www.screencast.com/t/UKOF9dJ2x

    If I disable your plugin, the emails go out with the correct from address, “Eric’s Site.”

    Also, separate bug: I also noticed in the German translation there are some weird backslashes on this page: https://…./wp-admin/options-general.php?page=wp-html-mail&tab=footer

    Namely: ‘Zeige den \”powered by\” Link in der E-Mail Fu?zeile’

    Screenshot: https://www.screencast.com/t/cV6rGs9quG3S

    Thanks
    Eric

    • This topic was modified 6 years, 1 month ago by Eric Mueller.
    • This topic was modified 6 years, 1 month ago by Eric Mueller.
    • This topic was modified 6 years, 1 month ago by Eric Mueller.
    • This topic was modified 6 years, 1 month ago by Eric Mueller.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Eric Mueller

    (@pnoeric)

    BTW I changed the subject line to include “Password reset for Eric’s site” and it looks like the apostrophie in the subject line is getting encoded too. This is a big problem on mobile since many iOS (and presumably Android) mail clients display the subject at the top of the message in bold. So it’s not subtle when the hashtag, ampersand etc all show up there. Yay computers, lol

    Thread Starter Eric Mueller

    (@pnoeric)

    This is happening now on a client site and as you can see the subject line is MUCH more prominent on a mobile device. ??

    IMG_0226.png

    Thread Starter Eric Mueller

    (@pnoeric)

    I found the issue. You decode HTML entities on line 373 of wp-html-mail/includes/class-haet-mail.php, but you don’t add the ENT_QUOTES flag.

    By default, html_entity_decode() does NOT decode single quotes. By adding this flag, it fixes the problem.

    
    // Field values in Ninja Forms and of course also in other plugins are encoded and otherwise not suitable for subjects
    $email['subject'] = html_entity_decode( $email['subject'], ENT_QUOTES );

    However… there’s no add_action() on this, so I can’t hook in to fix it on my client site yet. Still digging around in the code to figure out where I can hook ??

    Thread Starter Eric Mueller

    (@pnoeric)

    And I found my hook ??

    Here is my fix, for anyone else looking:

    // decode HTML entities in from address on email - so you can have subject line with apostrophie
    add_action( 'wp_mail', function ( $email ) {
    
    	$email['subject'] = html_entity_decode( $email['subject'], ENT_QUOTES );
    
    	return $email;
    }, 13 );        // priority 13 is after style_mail() function; we want to clean up after that

    I think this is still a bug that should be addressed, tho.

    Thanks for a great plugin and for a hook I could use to work around this minor issue.

    E

    • This reply was modified 6 years, 1 month ago by Eric Mueller.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Bug with apostrophie in site name’ is closed to new replies.