zzz wrote:I have a piece of PHP code. I also need to put it into mail message. Shall I use
heredoc in this case?
Well, I doubt that you want the raw PHP code to be placed in the mail body, so I'm assuming you mean the output of some PHP code? In that case... you can use whichever string syntax you prefer.
zzz wrote:Also, I am trying to construct mail message. How do I include a variable based on the condition if it exists?
Same way you would any other time you're constructing a string... one example being:
$string = "Hi there " . (isset($name) ? $name : '');