mirror of
https://github.com/itflow-org/itflow
synced 2026-12-02 00:59:03 +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:
@@ -9,7 +9,9 @@
|
||||
* 0 waiting - or scheduled, while its email_queued_at is still ahead
|
||||
* 1 being sent this minute
|
||||
* 2 failed - tried again every MAIL_QUEUE_RETRY_MINUTES until it has had
|
||||
* MAIL_QUEUE_TRIES; 99 tries means it isn't tried again (a bad address)
|
||||
* MAIL_QUEUE_TRIES; 99 tries means it isn't tried again (a bad address).
|
||||
* A domain with no mail server is a failed try like any other
|
||||
* (mailQueueDomainProblem()), as a lookup can fail for a moment
|
||||
* 3 sent - it keeps what it said, its calendar file and attachments, except
|
||||
* one that carried a link or code that opens something (email_sensitive:
|
||||
* a shared login, an invite, a password link, a signing or approval link),
|
||||
@@ -28,6 +30,23 @@ const MAIL_QUEUE_CANCELLED = 4;
|
||||
// Pictures that were in an email as data, kept once each for the queue to attach inline (emailInlineImages()) - the web can't reach uploads/tmp
|
||||
const MAIL_QUEUE_IMAGE_DIR = 'uploads/tmp/mail_images';
|
||||
|
||||
/*
|
||||
* Why mail can't go to $recipient's domain - '' when it can: it has a mail server (MX), or, with
|
||||
* none, an address of its own (A or AAAA), which takes its mail (RFC 5321). Asked before each try
|
||||
* (cron/mail_queue.php), so a lookup that failed for a moment is asked again on the next try
|
||||
* rather than ending the email.
|
||||
*/
|
||||
function mailQueueDomainProblem($recipient) {
|
||||
static $asked = []; // each domain once a run - a queue of email to one client asks once
|
||||
$recipient = (string) $recipient;
|
||||
$domain = strtolower(trim(substr($recipient, strrpos($recipient, '@') + 1)));
|
||||
if (!isset($asked[$domain])) {
|
||||
$asked[$domain] = $domain === '' || checkdnsrr($domain, 'MX') || checkdnsrr($domain, 'A') || checkdnsrr($domain, 'AAAA')
|
||||
? '' : "No mail server takes email for $domain - it has no MX record, and no address either";
|
||||
}
|
||||
return $asked[$domain];
|
||||
}
|
||||
|
||||
/* The tabs of the list - key => [label, icon, SQL for what is in it]. */
|
||||
function mailQueueTabs() {
|
||||
$tries = MAIL_QUEUE_TRIES;
|
||||
|
||||
Reference in New Issue
Block a user