Removed regex as we have the address from the header
This commit is contained in:
parent
57a5a9baeb
commit
fd14c51f85
@ -50,7 +50,7 @@ $headers = getallheaders();
|
|||||||
|
|
||||||
$qid = $headers['X-Rspamd-Qid'];
|
$qid = $headers['X-Rspamd-Qid'];
|
||||||
$rcpts = $headers['X-Rspamd-Rcpt'];
|
$rcpts = $headers['X-Rspamd-Rcpt'];
|
||||||
$sender = $headers['X-Rspamd-From'];
|
$sender_address = $headers['X-Rspamd-From'];
|
||||||
$ip = $headers['X-Rspamd-Ip'];
|
$ip = $headers['X-Rspamd-Ip'];
|
||||||
$subject = $headers['X-Rspamd-Subject'];
|
$subject = $headers['X-Rspamd-Subject'];
|
||||||
$priority = 0;
|
$priority = 0;
|
||||||
@ -67,12 +67,8 @@ if (is_array($symbols_array)) {
|
|||||||
|
|
||||||
$json = json_decode(file_get_contents('php://input'));
|
$json = json_decode(file_get_contents('php://input'));
|
||||||
|
|
||||||
$sender_address = $json->header_from[0];
|
$sender = $json->header_from[0];
|
||||||
$sender_name = '-';
|
$sender_name = trim(str_replace('<' . $sender_address . '>', '', $sender));
|
||||||
if (preg_match('/[a-zA-Z0-9.!#$%&’*+\/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)/i', $sender_address, $matches)) {
|
|
||||||
$sender_address = $matches[0];
|
|
||||||
$sender_name = trim(str_replace('<' . $sender_address . '>', '', $json->header_from[0]));
|
|
||||||
}
|
|
||||||
|
|
||||||
$rcpt_final_mailboxes = array();
|
$rcpt_final_mailboxes = array();
|
||||||
|
|
||||||
@ -217,18 +213,18 @@ foreach ($rcpt_final_mailboxes as $rcpt_final) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!empty($senders)) {
|
if (!empty($senders)) {
|
||||||
if (in_array($sender, $senders)) {
|
if (in_array($sender_address, $senders)) {
|
||||||
$sender_validated = true;
|
$sender_validated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($senders_regex) && $sender_validated !== true) {
|
if (!empty($senders_regex) && $sender_validated !== true) {
|
||||||
if (preg_match($senders_regex, $sender)) {
|
if (preg_match($senders_regex, $sender_address)) {
|
||||||
$sender_validated = true;
|
$sender_validated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($sender_validated === false) {
|
if ($sender_validated === false) {
|
||||||
error_log("NOTIFY: pushover pipe: skipping unwanted sender " . $sender);
|
error_log("NOTIFY: pushover pipe: skipping unwanted sender " . $sender_address);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($attributes['only_x_prio'] == "1" && $priority == 0) {
|
if ($attributes['only_x_prio'] == "1" && $priority == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user