[wp-trac] [WordPress Trac] #21095: Reset password link is in < RESET_URL > - Gmail does not show it.

WordPress Trac noreply at wordpress.org
Tue May 1 18:46:53 UTC 2018


#21095: Reset password link is in < RESET_URL > - Gmail does not show it.
--------------------------+----------------------
 Reporter:  tommix        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Mail          |     Version:  3.4
 Severity:  normal        |  Resolution:  invalid
 Keywords:  close         |     Focuses:
--------------------------+----------------------

Comment (by squarecandy):

 I also experienced this. Perhaps this is mainly a documentation issue as
 there is a pretty good solution using the filters already available. Here
 is what I ended up doing:

 {{{#!php
 <?php
 // adding support for html emails
 // this converts ALL wp_mail emails to HTML, which messes up the password
 reset email
 add_filter( 'wp_mail_content_type','squarecandy_set_content_type' );
 function squarecandy_set_content_type() {
         return "text/html";
 }

 // add this filter too
 // this will make the password reset email compatible with the HTML format
 add_filter( 'retrieve_password_message',
 'squarecandy_retrieve_password_message', 10, 2 );
 function squarecandy_retrieve_password_message( $message ) {
         // Revise the message content to make it HTML email compatible
         $message = str_replace('<','',$message);
         $message = str_replace('>','',$message);
         $message = str_replace("\n",'<br>',$message);
         return $message;
 }
 }}}

 The other solution is to adjust your `wp_mail_content_type` filter to only
 apply it to your custom emails. See
 https://wordpress.stackexchange.com/a/288159/41488

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/21095#comment:29>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list