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

WordPress Trac noreply at wordpress.org
Thu Sep 3 08:56:47 UTC 2015


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

Comment (by Rahe):

 Replying to [comment:22 julian.kimmig]:
 > Replying to [comment:18 SergeyBiryukov]:
 > > If your theme uses `wp_mail_content_type` filter to change the MIME
 type to `text/html` for all outgoing emails, the solution is to stop doing
 that and only enable that filter where you need it (see comment:10 and
 comment:12).
 > >
 > > Please try the support forums if you need theme-specific instructions:
 http://wordpress.org/support/.
 >
 > If someone doesn't want to do that is it possible to fix this by
 removing the < & > when in your custom filter:
 >
 >
 > {{{
 >
 > add_filter( 'wp_mail', 'dirty_wp_mail_filter' );
 > function dirty_wp_mail_filter( $args ) {
 >
 >       // you can include your custom html mail template here
 >       // just use file_get_contents() functions to get template file and
 any php replace function like
 >       // str_ireplace or preg_replace to replace your given placeholder
 in template by the content which is sent by wp
 >
 >       $stripped_mail_content = preg_replace("/<http(.*)>/m", "http$1",
 $args['message']);
 >       add_filter( 'wp_mail_content_type',
 'dirty_notification_content_type' );
 >       $dirty_wp_mail = array(
 >               'to'          => $args['to'],
 >               'subject'     => $args['subject'],
 >               'message'     => $stripped_mail_content,
 >               'headers'     => $args['headers'],
 >               'attachments' => $args['attachments']
 >       );
 >       return $dirty_wp_mail;
 > }
 >
 > function dirty_notification_content_type() {
 >       return 'text/html';
 > }
 > }}}
 >
 > some kind of dirty for some of u.. but i hope this helps, too. :)

 Thank you for the temporary patch, I have improved it because of possible
 https sites and maybe the 'message' index does not exists :

 {{{
 function dirty_wp_mail_filter( $args ) {

         /**
          * Get HTML or message
          */
         $index = isset( $args['html'] ) ? 'html' : 'message';

         // you can include your custom html mail template here
         // just use file_get_contents() functions to get template file and
 any php replace function like
         // str_ireplace or preg_replace to replace your given placeholder
 in template by the content which is sent by wp
         // Fix content taking into account the http/https
         $args[$index] = preg_replace("/\<((https|http)(.*))\>/", "$2$3",
 $args[$index] );

         add_filter( 'wp_mail_content_type',
 'dirty_notification_content_type' );

         return $args;
 }
 }}}

 Mayeb this can help somebody too :)

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


More information about the wp-trac mailing list