Jump to content

[SOLVED] Variables in an HTML email


tqla

Recommended Posts

Hi. I am using this bit of code to send an HTML email:

    //email
    $to = "$email";
    $from = "[email protected]";
    $subject = "Reward";
    //begin html message
    $message = <<<EOF
<html>
  <body bgcolor="#DCEEFC">
    <center>
        <b>I want to add the variables in this section!</b>
        </center>
      <br><br>
  </body>
</html>
EOF;
   //end of message
    $headers  = "From: $from\r\n";
    $headers .= "Content-type: text/html\r\n";
    $to = "$to, $from"; // this will send to both emails at the same time.
    // now lets send the email.
    mail($to, $subject, $message, $headers);

 

There are two variables that I would like to include in the HTML portion of the email. One is '$firstname' and the other is '$lastName'.

 

I've done it before with plain emails but not with HTML emails. Is there a way to do this?

 

Thanks.

 

 

Link to comment
https://forums.phpfreaks.com/topic/58355-solved-variables-in-an-html-email/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.