Reputation: 75
I am getting data through Second Life to a PHP script and the PHP script is sending the data through an email.
My question is how to get the time (which is the variable $time) into the subject line of the email. Right now, it is just ignoring the variable $time.
Here is that part of my code:
$time = $_POST["time"];
$log = $_POST["log"];
$to = "[email protected]";
$subject = <<<TEST
New Visitor; VDC2; $time
TEST;
$theMes = <<<TEST
Visitor Log for VDC2:
$log
TEST;
$headers = 'From: [email protected]' . "\r\n" .
'Message-Id: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $theMes, $headers);
Upvotes: 2
Views: 160
Reputation: 4879
Why don't you write the $subject variable like this instead?
$subject = "New Visitor; VDC2; " . $time;
And while you're at it, write $theMes like this:
$theMes = "Visitor Log for VDC2:" . "\n\n" .
$log;
If that doesn't work try encoding the content. I still don't know why it wouldn't display but this might be worth a shot since mail does encode.
$subject = "New Visitor; VDC2; " . $time;
$subject = '=?UTF-8?B?'.base64_encode($subject).'?=';
There could be something with the semicolons or timestamp that's confusing PHP.
Upvotes: 2