Problem formatting PHP-generated E-mail
In my website, if a Member reports another Member's Profile, then my PHP script sends an e-mail to the Administrator that should look like this...
Here is my PHP code...
When a Member's files a complaint, the e-mail I get is all on one long line and looks like this...
What am I doing wrong? :confused:
I also tried the above code without the PHP_EOL thingy and that doesn't help either?!
BTW, my admin account is in Gmail, and I'm sure this same code was working months ago, but as I am doing final testing on my website, I now see the Admin E-mail is screwed up?! :(
Help would be appreciated!!
Try changing all of this:
$body = $currTime . "\n\n" . PHP_EOL;
$body .= "Dear Admin,\r\n\r\n" . PHP_EOL;
$body .= "A complaint was made about $user's Member Profile by $sessUsername.\r\n\r\n";
$body .= "Here is the complaint...\r\n\r\n" . PHP_EOL;
$body .= "$issue!!\r\n\r\n" . PHP_EOL;
$body = "
A complaint was made about $user's Member Profile by $sessUsername.
Here is the complaint...
When you get the email, it should be formatted
just like the text layout. No need to add \n or EOL.
I guess that I should add that I've always done it this
way with shared webhosts ... maybe Gmail is different?
In HTML newlines are collapsed for display. You need to convert those \n characters to <br> tags manually, or leave them and convert the body when you send the message:
|All times are GMT +1. The time now is 04:19 PM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.