From b528b931788f611e052c8228bf182ddab0e31a13 Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Thu, 11 Nov 2010 09:23:53 +0000 Subject: [PATCH] - fix sender-address of responder-mail (only 'common'-setups!!!), fixes #476 --- scripts/jobs/cron_autoresponder.php | 35 ++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/scripts/jobs/cron_autoresponder.php b/scripts/jobs/cron_autoresponder.php index 390eacb6..0b0fa8c2 100644 --- a/scripts/jobs/cron_autoresponder.php +++ b/scripts/jobs/cron_autoresponder.php @@ -132,24 +132,40 @@ if($db->num_rows($result) > 0) } //fetching to field - if(!strlen($to) - && preg_match("/^To:(.+)<(.*)>$/", $line, $match) + if((!strlen($to) || $to != $row['email']) + && preg_match("/^To:(.+)<(.*)>$/", $line, $match) ) { $to = $match[2]; } - elseif(!strlen($to) - && preg_match("/^To:\s+(.*@.*)$/", $line, $match) + elseif((!strlen($to) || $to != $row['email']) + && 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]; } //fetching sender field - if(!strlen($to) + if(!strlen($sender) && preg_match("/^Sender:(.+)<(.*)>$/", $line, $match) ) { $sender = $match[2]; } - elseif(!strlen($to) + elseif(!strlen($sender) && preg_match("/Sender:\s+(.*@.*)$/", $line, $match) ) { $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 if($spam == true) {