Add missing placeholder to HTML Email Templates plugin


The screenshot for the iLetters template (and others) indicates that the recipient’s email should be available as a placeholder – it says, “Dear Name goes here at email goes here“, but the placeholder is not actually available.

It is common practice to say something in an email like, “This email was sent to“, so I added the placeholder with a few quick edits to htmlemail.php. The following code adds the {USER_EMAIL} placeholder, makes the replacement, and adds the new entry to the variables menu in admin.

At line 960, update the $content variable

$content = preg_replace(array("/({USER_NAME})/",  "/({USER_EMAIL})/"),
array('John', ''),
$content );

At line 779, update the $placeholder_desc variable

'{USER_EMAIL}' => __( 'The email address of the recipient', 'htmlemail' ),

At line 268, replace the placeholder with the actual value

$message = preg_replace( '~{USER_EMAIL}~', $to, $message );

I’ve verified that it works in both the preview and in the actual emails. I’m redesigning all the templates to HTML5 and this placeholder would be really helpful!