Fix Broken Password Reset Emails When Using Paid Memberships Pro

In one of the support threads, a user complain that password reset emails arriving without the link.

After a lot of checking, I found that Paid Memberships Pro is forcing HTML type emails for every email sent.
The developer did implement some kind of fix when using the native WordPress mailing system but ignored the case that you will use SMTP mailer plugin like Post SMTP.

I wrote a small code you can put in your theme functions.php that will fix the issue.

if ( defined( 'PMPRO_VERSION' ) ) {
    add_filter( 'retrieve_password_message', 'post_smtp_retrieve_password_message', 10, 1 );
}
function post_smtp_retrieve_password_message( $message ) {
        $message = str_replace('<','',$message);
        $message = str_replace('>','',$message);
        $message = str_replace("\n",'<br>',$message);
        
        return $message;
}

You can download it as a plugin from here: post-smtp-pmpro-fix

 

Share on facebook
Facebook
Share on google
Google+
Share on twitter
Twitter
Share on linkedin
LinkedIn

Leave a Comment

Your email address will not be published. Required fields are marked *