I need help with the below script
public function replace_retrieve_password_message( $message, $key, $user_login, $user_data ) {
// Create new message
$msg = __( 'Hello!', 'personalize-login' ) . "\r\n\r\n";
$msg .= sprintf( __( 'You asked us to reset your password for your account using the email address %s.', 'personalize-login' ), $user_login ) . "\r\n\r\n";
$msg .= __( "If this was a mistake, or you didn't ask for a password reset, just ignore this email and nothing will happen.", 'personalize-login' ) . "\r\n\r\n";
$msg .= __( 'To reset your password, visit the following address:', 'personalize-login' ) . "\r\n\r\n";
$msg .= site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user_login ), 'login' ) . "\r\n\r\n";
$msg .= __( 'Thanks!', 'personalize-login' ) . "\r\n";
return $msg;
}
This is replacing the Wordpress reset password email. It functions great and is working a treat. However, it is not very pretty and I want to replace it with an HTML email.
Is there a way that I can add HTML to this and still keep the function of printing the URL and user email address? For example;
<div>
<h1>Hello</h1>
<p>You asked us to reset your password for your account using the email address <?php PRINT USER EMAIL ?></p>
<a href="<?php PRINT URL ?></a>
</div>
I know that the above is very basic and the PHP is not correct but if I wanted to replace the Plain Text email with this, how would I do it? Is it perhaps possible to create a separate PHP file with the HTML content and return the content from this template?
Your time is always greatly appreciated.
The solution to my question was done in two parts
First was to add to the
functions.phpSecond is added within a custom plugin as shown below
I have now used this method to replace all core Wordpress Messages with entire
emailtemplates, includinghtmlbodyandheadtags.Thank you for those who had an input into my solution.