Reset password email in wordpress

Setting a nice mail template to the outgoing mails from your site is really a great idea. It not only makes the email look better, but also gives a professional touch to the content.

However, sending reset password email in wordpress by using html content type is most probably going to land you in trouble if the the recipient has gmail. The link to reset password is sent wrapped in “<>”, e.g http://link-to-reset-your-password >. Gmail will filter out the reset password link ( or any content for that matter ) that is wrapped in “<>”. This issue can be viewed here.

Therefore, to send a reset password link using html mail templates, we simply need to replace “< and “>” with any other character like “(”  and “)“.

An example of how this can be done using filters is:

add_filter('retrieve_password_message', 'ti_retrieve_password_message');

function ti_retrieve_password_message( $message )
{
  return str_replace(array("<", ">"), array("(", ")"), $message );
}