WordPress.org

Ready to get started?Download WordPress

Forums

wpMandrill
wpMandrill Affecting Password Reset Email Content and Link Formatting (15 posts)

  1. Adam W. Warner
    Member
    Posted 7 months ago #

    Hi guys,

    We’ve just found an issue with the formatting and link included in password reset emails. We've narrowed it down to the wpMandrill plugin as deactivating solves the issue described below.

    Email comes in like this:

    (username edited to protect the innocent)
    Someone requested that the password be reset for the following account: http://ourwebsite.com/ Username: testuser If this was a mistake, just ignore this email and nothing will happen. To reset your password, visit the following address: /ourwebsite.com/wp-login.php?action=rp&key=2C4WNkhEGno3AVQhVqeX&login=testuser>

    Notice the lack of line breaks and also that the “http:/” is missing from the front and that there is a “>” symbol at the end.

    When clicking this link, it goes to a 404 (not surprising). If you add the “http:/” and remove the “>”, it works as expected taking the user to the password reset page.

    http://wordpress.org/plugins/wpmandrill/

  2. Adam W. Warner
    Member
    Posted 7 months ago #

    Can anyone from MailChimp address this please?

  3. MC_Will
    Member
    Plugin Author

    Posted 7 months ago #

    Hi Adam,

    Did you try to activate the switch "Replace all line feeds by
    in the message body?"?

  4. Adam W. Warner
    Member
    Posted 7 months ago #

    I'll have a look at that now and report back...

  5. Adam W. Warner
    Member
    Posted 7 months ago #

    Do you mean to checkmark this setting?

    Content
    Replace all line feeds ("\n") by
    in the message body?
    If you are sending HTML emails already keep this setting deactivated.
    But if you are sending text only emails (WordPress default) this option might help your emails look better.

  6. Adam W. Warner
    Member
    Posted 7 months ago #

    OK, that worked for password reset emails. We also use some HTML email sends from the Easy Digital Downloads plugin. You're setting says not to activate with HTML emails, so we'll see how that goes;)

    Thanks for your reply here. I appreciate it!

  7. MC_Will
    Member
    Plugin Author

    Posted 7 months ago #

    Adams,

    We just released a new version of this plugin. We added a new filter, mandrill_nl2br, that allows you to change that flag on the fly.

    For example:

    function forgotMyPasswordEmails($nl2br, $message) {
        if ( in_array( 'wp-retrieve_password', $message['tags']['automatic'] ) ) {
            $nl2br = true;
        }
        return $nl2br;
    }
    add_filter( 'mandrill_nl2br', 'forgotMyPasswordEmails' );

    Let me know how it goes.

  8. Adam W. Warner
    Member
    Posted 7 months ago #

    I'm going to call you Will, hope that's your name:)

    So yes, checking that setting has added some unexpected line breaks in both our EDD emails and also our Gravity Forms submissions (which is connected to our HelpScout account and making for some support tickets with a lot of white space;)

    Thanks for providing that filter function. Can you confirm, is that added to our theme's functions.php file or somewhere else.

    I didn't see any option in the Mandril plugin settings to add custom code.

  9. MC_Will
    Member
    Plugin Author

    Posted 7 months ago #

    Yes, that's my name :)

    You could add it to your theme's functions.php file, yes, but my preferred method is to add it to a general purpose plugin specially created for the site though. It doesn't need to do anything fancy.

    If you're using a child theme, then it's a bit better... but still, I'd go for a basic utility plugin created for the site.

  10. Adam W. Warner
    Member
    Posted 7 months ago #

    Got it, thanks. Will be testing and will come back with results:)

    p.s. Do you rap too, because "MC_Will" sure sounds like you should be;)

  11. MC_Will
    Member
    Plugin Author

    Posted 7 months ago #

  12. Adam W. Warner
    Member
    Posted 7 months ago #

    Ha! Perfect.

  13. nullvariable
    Member
    Posted 6 months ago #

    I also experienced issues with this, turning on the checkbox fixed the password reset emails, the filter above had no effect with the checkbox off. I didn't seem to need the filter with the checkbox on.

    Perhaps this should be a default for that type of email?

    Also that video cracked me up, thanks for being awesome.

  14. kylerollins
    Member
    Posted 5 months ago #

    I had this problem too...just disabled the app and moved on. May have the patience to mess with these settings later...

  15. hjbarraza
    Member
    Posted 3 months ago #

    I modified wp-login.php line 358 to 363 and it worked great.
    I'm just afraid that it will get overwritten next time wordpress self-updates itself.

    $message = __('Someone requested that the password be reset for the following account:') ."<br/>" ."\r\n\r\n";
    	$message .= network_home_url( '' ) . "\r\n\r\n";
    	$message .= sprintf(__('Username: %s'), $user_login) . "<br/>" ."\r\n\r\n";
    	$message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "<br/><br/>" ."\r\n\r\n";
    	$message .= __('To reset your password, visit the following address:') . "<br/>" ."\r\n\r\n";
    	$message .= '<a href="' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login')  .'">' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') .'</a>'. "\r\n";

Reply

You must log in to post.

About this Plugin

About this Topic