I want to use a SendGrid transactional template to format emails which I am sending using the wp_mail
function.
I'm sending emails like this:
function mytheme_send_email($user, $message){
$email = $user->user_email;
$subject = "A message from my app!";
$admin_email = get_option('admin_email');
$headers = "From: ". $admin_email . "\r\n" ."Reply-To: " . $email . "\r\n";
$sent = wp_mail($email, $subject, strip_tags($message), $headers);
}
I have an HTML template on SendGrid, which I have set as the default template in my wordpress sendgrid plugin. I am not sure how to actually write the template. Here is the relevant part:
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 600px;">
<tr>
<td bgcolor="#ffffff" align="left" style="padding: 24px; font-family: 'Source Sans Pro', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;">
<h1 style="margin: 0 0 12px; font-size: 32px; font-weight: 400; line-height: 48px;"></h1>
<p style="margin: 0;"> <%message%> </p>
</td>
</tr>
</table>
I don't know how to get the <%message%> to display. When I try sending an email, it literally says <%message%>. I want to be able to display the $message that I passed to mytheme_send_email
within my template.
Any help is appreciated!