- fix sender-address of responder-mail (only 'common'-setups!!!), fixes #476

This commit is contained in:
Michael Kaufmann (d00p)
2010-11-11 09:23:53 +00:00
parent 7ca00d56be
commit b528b93178

View File

@@ -132,24 +132,40 @@ if($db->num_rows($result) > 0)
} }
//fetching to field //fetching to field
if(!strlen($to) if((!strlen($to) || $to != $row['email'])
&& preg_match("/^To:(.+)<(.*)>$/", $line, $match) && preg_match("/^To:(.+)<(.*)>$/", $line, $match)
) { ) {
$to = $match[2]; $to = $match[2];
} }
elseif(!strlen($to) elseif((!strlen($to) || $to != $row['email'])
&& preg_match("/^To:\s+(.*@.*)$/", $line, $match) && preg_match("/^To:\s+(.*@.*)$/", $line, $match)
) {
$to = $match[1];
}
/*
* if we still don't have a To:-address
* OR even worse, the $to is NOT the mail-address
* of the customer which autoresponder this is
* we have to check for CC too, #476
*/
elseif((!strlen($to) || $to != $row['email'])
&& preg_match("/^Cc:(.+)<(.*)>$/", $line, $match)
) {
$to = $match[2];
}
elseif((!strlen($to) || $to != $row['email'])
&& preg_match("/^Cc:\s+(.*@.*)$/", $line, $match)
) { ) {
$to = $match[1]; $to = $match[1];
} }
//fetching sender field //fetching sender field
if(!strlen($to) if(!strlen($sender)
&& preg_match("/^Sender:(.+)<(.*)>$/", $line, $match) && preg_match("/^Sender:(.+)<(.*)>$/", $line, $match)
) { ) {
$sender = $match[2]; $sender = $match[2];
} }
elseif(!strlen($to) elseif(!strlen($sender)
&& preg_match("/Sender:\s+(.*@.*)$/", $line, $match) && preg_match("/Sender:\s+(.*@.*)$/", $line, $match)
) { ) {
$sender = $match[1]; $sender = $match[1];
@@ -169,6 +185,13 @@ if($db->num_rows($result) > 0)
} }
} }
// check if the receiver is really the one
// with the autoresponder
if(!strlen($to) || $to != $row['email'])
{
$to = '';
}
//skip mail when marked as spam //skip mail when marked as spam
if($spam == true) if($spam == true)
{ {