Skip to content
Advertisement

Unable to send SESSION DATA to email via PHPmailer

I am trying to send an email upon successful order placed on my website, however the email delivers but the details (WHICH ARE STORED IN THE SESSION VARIABLE $_SESSION[“cart”]) doesn’t send along with it.

Here is my php code

JavaScript

And here is an image of the email to display what I am talking about better

The Email which sends upon processing

Advertisement

Answer

You’re building your content incorrectly. This will not work:

JavaScript

The PHP tags inside the single quotes will be ignored, which should be apparent if you inspect the source of a received message. Go back into PHP mode to run that code, like this:

JavaScript

You could use your original code if eval() what ends up in $body before using it, but that would be slower and somewhat dangerous.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement