I am piping email from Outlook Express & Web Mail to a php app that scans in the mail and puts it in a datbase. I have two seperate domains with seperate web sites. I am running this scanner (identical) on both.
If I email the support address on the first domain, the scanner takes the piped email and does exactly what it is supposed to do.
If I email the second support address to the second domain, the scanner appears to be doing the same thing except one big problem. After I send the Outlook Express email to this scanner, instead of getting back one notification that the scan worked ok , I get back almost 1000 of these "worked ok" messages.
I have checked and double checked the code, the pipe statement, etc. I am running both sites on CPanel on the same server. I am stumped ! Anyone have any suggestions at all ?
for ($i=0; $i<count($lines); $i++) {
if ($splittingheaders) {
// this is a header
$headers .= $lines[$i]."\n";
// look out for special headers
if (preg_match("/^Subject: (.*)/", $lines[$i], $matches)) {
$subject = $matches[1];
}
// look out for special headers
if (preg_match("/^Date: (.*)/", $lines[$i], $matches)) {
$date = $matches[1];
}
if (preg_match("/^From: (.*)/", $lines[$i], $matches)) {
$from = $matches[1];
}
} else {
// not a header, but message
$message .= $lines[$i]."\n";
}
if (trim($lines[$i])=="") {
// empty line, header section has ended
$splittingheaders = false;
}
}
include ('config.php');
include ('defaults.php');
include ('escapeq.php');
include ('email_strip.php');
// Check the above email 'from' string for MIME format.
$from = strip_email_from($from);
$sql = "INSERT INTO emailqueue SET fromaddress='$from', datex='$date', subject='$subject', body='$message'";
if (@mysql_query($sql)) {
mail (EMAIL , 'Incoming Support Request', 'Check your AHD Email Queue for details');
} else {
mail( EMAIL, 'Error writing support request', mysql_error());
}
Bookmarks