SparkPost / wordpress-sparkpost

WordPress plugin to use SparkPost email
https://wordpress.org/plugins/sparkpost/
20 stars 15 forks source link

Forget Passordword link is not including in email when using Template #48

Closed xianx closed 8 years ago

xianx commented 8 years ago

Just noticed that When ever user request reset password via /wp-login.php?action=lostpassword form forget password link is not sending via email when using template. http://prntscr.com/az7u4c

I have tested without template, its fine. http://prntscr.com/az7w1t

How to fix the problem?

yargevad commented 8 years ago

Hi @xianx, what does your template code look like for that link?

rajumsys commented 8 years ago

How you've used content in your template? If you want to substitute without escaping content, you need to use {{{content}}} (note 3 curly braces) instead of {{content}}.

xianx commented 8 years ago

@yargevad I have already included screenshot http://prnt.sc/az7u4c

yargevad commented 8 years ago

Let me explain more clearly. That screenshot shows a rendered template. I'm interested in what the source of your template looks like, including all of the curly braces, like @rajumsys shows above.

xianx commented 8 years ago

https://gist.github.com/xianx/74a1e8cdbd701c79f7ff576d26514b2c

xianx commented 8 years ago

I have just tested that when ever 2 curly bracket is using Forget link is sending but link tracking and line breaks are not working.

davekiss commented 8 years ago

I'm having this issue as well. My template is using the triple braced {{{content}}} - I think it has something to do with the formatting of the WordPress password reset message that is generated by WP core, shown here:

https://github.com/WordPress/WordPress/blob/283c367df717de4757910ebc906886f8f6f5154e/wp-login.php#L333-L338

My temporary work-around is to override that message with a custom filter:

/* Edit the Lost Password Email */
function sparkpost_retrieve_password_message( $message, $key, $user_login, $user_data ) {
  $message = __('Someone has requested a password reset for the following account:') . "<br /><br />";
  $message .= network_home_url( '/' ) . "<br /><br />";
  $message .= sprintf(__('Username: %s'), $user_login) . "<br /><br />";
  $message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "<br /><br />";
  $message .= __('To reset your password, visit the following address:') . "<br /><br />";
  $message .= network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login');
  return $message;
}

add_filter('retrieve_password_message', 'sparkpost_retrieve_password_message', 10, 4);
dws122 commented 6 years ago

@rajumsys this appears to still an issue in 3.0.1, especially with gmail clients or Google Apps for work.

Can this be included in the 3.1 release?