mirror of
https://github.com/itflow-org/itflow
synced 2026-12-02 09:09:01 +00:00
Stop ITFlow's own mail looping back: its own addresses are never made watchers or emailed about a ticket, mail from them is set aside in the ITFlow folder without a ticket, and Email new tickets to can't be the mailbox ITFlow reads; take email someone opened in the hour before the parser got to it; a domain whose mail server can't be found is retried like any failed email and one taking mail at its own address is accepted; 26.12.3 changelog entries
This commit is contained in:
@@ -446,15 +446,16 @@ if (mysqli_num_rows($sql_queue) > 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// More intelligent recipient MX check (if not disabled with --no-mx-validation)
|
||||
$domain = escapeSql(substr($email_recipient, strpos($email_recipient, '@') + 1));
|
||||
if (!in_array('--no-mx-validation', $argv) && !checkdnsrr($domain, 'MX')) {
|
||||
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 2, email_attempts = 99, email_failed_at = NOW()"
|
||||
. mailQueueErrorSql('No mail server takes email for ' . substr($email_recipient, strpos($email_recipient, '@') + 1) . ' - it has no MX record') . " WHERE email_id = $email_id");
|
||||
// A domain with no mail server (if not disabled with --no-mx-validation) - a failed try like any other, tried
|
||||
// again as they are, as a lookup can fail for a moment. It used to end the email there and then
|
||||
$domain_problem = in_array('--no-mx-validation', $argv) ? '' : mailQueueDomainProblem($email_recipient);
|
||||
if ($domain_problem !== '') {
|
||||
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 2, email_attempts = 1, email_failed_at = NOW()" . mailQueueErrorSql($domain_problem) . " WHERE email_id = $email_id");
|
||||
$email_to_logging = escapeSql($email_recipient);
|
||||
$email_subject_logging = escapeSql($rowq['email_subject']);
|
||||
logApp("Cron-Mail-Queue", "Error", "Failed to send email: $email_id to $email_to_logging due to invalid recipient domain (no MX). Email subject was: $email_subject_logging");
|
||||
appNotify("Mail", "Failed to send email #$email_id to $email_to_logging due to invalid recipient domain (no MX): Email subject was: $email_subject_logging");
|
||||
logApp("Cron-Mail-Queue", "Error", "Failed to send email: $email_id to $email_to_logging - " . escapeSql($domain_problem) . ". Email subject was: $email_subject_logging");
|
||||
appNotify("Cron-Mail-Queue", "Failed to send email #$email_id to $email_to_logging - " . escapeSql($domain_problem) . " - it is tried again in " . MAIL_QUEUE_RETRY_MINUTES . " minutes",
|
||||
"/admin/mail_queue.php?show=retrying", 0, $email_id);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -541,6 +542,11 @@ if (mysqli_num_rows($sql_failed_queue) > 0) {
|
||||
}
|
||||
|
||||
try {
|
||||
// Its domain asked again - a failed try, as one that won't send is, until the last of them
|
||||
$domain_problem = in_array('--no-mx-validation', $argv) ? '' : mailQueueDomainProblem($email_recipient);
|
||||
if ($domain_problem !== '') {
|
||||
throw new \RuntimeException($domain_problem);
|
||||
}
|
||||
sendQueueEmail(
|
||||
($config_smtp_provider ?: 'standard_smtp'),
|
||||
(string)$config_smtp_host,
|
||||
|
||||
Reference in New Issue
Block a user