@minusten, your script is rather cumbersome. You are concatenating variables, dispite them already being in double quotes (to interpolate them). You also could use the predefined constant PHP_EOL, so that there will be a carriage return regardless of what architecture you are working on.
What you will notice in my script above is that I do not bother concatenating or interpolating variables. This means there is no resource overhang for php when try to parse the variable $body.
First off, you’re code won’t actually run… $body is a variable/string, not echo, so those commas won’t work as you HAVE to use string addition there.
Second, one could use single quotes as you did and then OMIT PHP EOL and just use actual carriage returns in the code instead of screwing with extra vars or escape codes.
Functional equivalent, and even simpler. (and this one would actually run).
Oh, and @ the OP, adding HTML to e-mails is just a great way to get them flagged as spam; you want colors and bold and the like, then you don’t want e-mails. Stick to plain-text, then your mails might actually have a chance of reaching people.
Whoops, yes you are correct (im not sure why but i thought i was writing about echoing out content…). Using commas for stacking can only be done in echo, and yes seen as it is a variable there is no need to use the constant PHP_EOL.
And alternative to your code above would be using heredoc: