Echo PHP In Email

Hi,

I am trying echo an activation code in an email. However whatever I try including putting them inside the PHP tags just displays the text instead of any form of PHP being echoed.

Can anyone advise how I can echo PHP inside an email. I am using single commas to start and finish the email, is that the problem?

          $message = '
<html>
<body>
Welcome to Website.com <br><br>
<php echo $activationcode ?>
<a href="http://www.eventvital.com/test/activation.php?activation=$activationcode"
 ?>Click Here</a> to activate your account.

</body>
</html>
';

It’s because you’re just making the php code part of a string.

You need to come out of the string and get rid of the echo statement.

Something like this:


          $message = '
<html>
<body>
Welcome to Website.com <br><br>' .
$activationcode .'
<a href="http://www.eventvital.com/test/activation.php?activation='.$activationcode.'"
 ?>Click Here</a> to activate your account.

</body>
</html>
';

Edit: Note the placement of the full stops and the placement of the ’ marks.