|
Hi! I created a bounced email management system. All bounced email are returned to a specified email and from this email it will be redirected to a script that will parse the bounced email so that I can be able to get the recipients address and the reason why it is bounced. It perfectly redirected to my script but the problem is when I loop over it, it doesn't store to a variable ($strReason). Here's the code:
// read from stdin
$fd = fopen("php://stdin", "r");
$email = "";
while (!feof($fd)) {
$email .= fread($fd, 1024);
}
fclose($fd);
// handle email
$lines = explode("\n", $email);
$strReason = "";
for ($x = 0; $x < count($lines); $x++){
$strReason .= $lines[$x];
}
// Store bounced email to database
$sql = "INSERT INTO tbl_bounced_email(Reason) VALUES('$strReason')";
$r = mysql_query($sql, $link) or die (mysql_error().' '.$sql);
but when i set the loop to 16 only, it stores the message to $strReason
for ($x = 0; $x < 16; $x++){
$strReason .= $lines[$x];
}
|