diff --git a/CHANGELOG.md b/CHANGELOG.md index 7601df830..33a3328ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ This file documents all notable changes made to ITFlow. ### Upgrading to 26.12.3 -Update from Maintenance > Update as usual - this release has eight database changes: 4.2.2 adds a table for passkeys and a setting to turn them on or off, 4.2.3 lets a document keep the Markdown it was written in, 4.2.4 lets a ticket keep its pictures as files, 4.2.5 adds identity providers, 4.2.6 keeps each ticket's email conversation together, 4.2.7 lets a reply from a CC say who sent it, 4.2.8 renames the watchers table for CCs, and 4.2.9 lets the mail queue go at a pace your mail host takes. The client portal's Microsoft 365 single sign-on becomes the first identity provider, for client contacts, and keeps its redirect address, so nothing changes in Microsoft Entra. Nothing else is required: passkeys are on, and no one has one until they add it. Pictures already inside tickets move to files in the background afterwards - the new Ticket Pictures job in Maintenance > Cron does a batch a minute, so an install with years of emailed screenshots may take a while, and tickets work as usual meanwhile. A passkey is made for your ITFlow's address (the one in config.php) and only works there, over HTTPS - if you move ITFlow to a new address, everyone adds theirs again. Watchers are called CCs now. Emails about a ticket go to its contact with the CCs copied in, rather than one each - Admin > Settings > Tickets has the switch, under Emails about a ticket. +Update from Maintenance > Update as usual - this release has nine database changes: 4.2.2 adds a table for passkeys and a setting to turn them on or off, 4.2.3 lets a document keep the Markdown it was written in, 4.2.4 lets a ticket keep its pictures as files, 4.2.5 adds identity providers, 4.2.6 keeps each ticket's email conversation together, 4.2.7 lets a reply from a CC say who sent it, 4.2.8 renames the watchers table for CCs, 4.2.9 lets the mail queue go at a pace your mail host takes, and 4.3.0 lets contacts unsubscribe from bulk email. The client portal's Microsoft 365 single sign-on becomes the first identity provider, for client contacts, and keeps its redirect address, so nothing changes in Microsoft Entra. Nothing else is required: passkeys are on, and no one has one until they add it. Pictures already inside tickets move to files in the background afterwards - the new Ticket Pictures job in Maintenance > Cron does a batch a minute, so an install with years of emailed screenshots may take a while, and tickets work as usual meanwhile. A passkey is made for your ITFlow's address (the one in config.php) and only works there, over HTTPS - if you move ITFlow to a new address, everyone adds theirs again. Watchers are called CCs now. Emails about a ticket go to its contact with the CCs copied in, rather than one each - Admin > Settings > Tickets has the switch, under Emails about a ticket. ### New Features & Updates @@ -63,6 +63,10 @@ Update from Maintenance > Update as usual - this release has eight database chan - Two people at a client raising the same problem in the same week - "Printer not working" - get a ticket each, linked as related, rather than the second email landing on the first person's ticket. It's still a reply on the ticket from its contact or a CC. - A reply to a closed ticket is kept on it as an internal note instead of left in the mailbox, and the notice says so - to the agent it was assigned to, or the admins when nobody had it. The ticket isn't reopened. The client or CC is told it is closed, as before - but not someone with no part in the ticket, who learned nothing from a number they guessed. - Mail queue: email goes out at a pace your mail host takes - 30 a minute to start, set under Pace in Admin > Settings > Mail, Sending - over one connection - password links and invites first, email from the contacts or clients list last. A host's limit doesn't lose email any more: the rest wait their turn. A failed email is tried again over about eight hours, sooner at first. An address the mail server says doesn't exist isn't tried again, and its contact shows Email bounced; turned away for any other reason - the server's own rules, a full mailbox - an email is tried again. A mail server ITFlow can't reach or sign in to costs no email a try - it waits, and goes once it can. Admins hear about the queue once an hour at most, where every agent got a notice for each failed email. +- Bulk email (Email on the contacts or clients list) leaves out contacts marked Email bounced, and those who unsubscribed - the message after sending says how many, and the Email window says so before you send to the contacts picked. Each email has an Unsubscribe link at its foot, and mail programs show their own Unsubscribe button for it (List-Unsubscribe, one click), which Gmail and Yahoo ask of anyone sending in bulk. Leaving is about the address: every contact with it stops getting bulk email, at any client - ticket emails, invoices and quotes still go. +- Unsubscribing: the link asks first, then says it's done and offers Subscribe Again, so a link checker opening it changes nothing. A contact's page has Bulk email - Gets it or Unsubscribed, with Unsubscribe and Subscribe again for when they ask you - the contacts list and quick look show an Unsubscribed badge, and in the client portal Your account has News from us under Emails from us. +- Bulk email's Send at is on the agent's own clock (Account > Preferences), and the window says so when it isn't the company's - 9:00 typed in Tokyo was sent at 9:00 New York time. +- Bounces of bulk email come back to the mailbox ITFlow reads, where the contacts are marked Email bounced - when that can be done safely: email to ticket on, mail going by SMTP rather than Microsoft Graph, ITFlow signing in as that mailbox or not at all, and the email from the same domain. They went to the mailbox it was sent from, which ITFlow doesn't read. The Email window says where they go for the mailbox picked. - Every email has a plain text part beside its HTML, and names the machine sending it by ITFlow's own address rather than the server's own name ("vm", say) - both counted against an email with spam filters. - Email-to-ticket checks who an email is really from, by what your mail server found as it arrived (SPF, DKIM and DMARC). An email that failed - DMARC for a domain that asks for forged email to be rejected or quarantined, or SPF with nothing else passing - is treated as from a stranger, whoever it says it's from: a reply is an internal note saying which check failed and reopens nothing, adds nobody and goes to nobody; a new email still makes a ticket, with a note, but copies nobody in, gets no answer and isn't emailed to the client's colleagues who hear about new tickets; it never makes a contact; and it doesn't clear an address's Email bounced. An email that says it's from one of your agents isn't taken as their note. A domain that asks nothing of forged email (DMARC p=none) is taken as before. - Email-to-ticket: someone who isn't a contact is answered "[TCK-123] We have your email", without their own subject or a link to the ticket, which shows what they wrote. Anyone can send an email that says it's from someone else, and the answer carried their words to that person from your mailbox. @@ -93,6 +97,7 @@ Update from Maintenance > Update as usual - this release has eight database chan - Mail queue: an email whose To address went but one of the people copied in was turned away was sent to everyone again, up to three more times. It goes once now, and says who was turned away. - Email-to-ticket: an email with no sender address was answered at itflow-guest@example.com, which was also made the ticket's CC - each email to it failed in the mail queue. It's from nobody now: a ticket with no client when unknown senders are let in, saying it has no sender address, with nobody answered or copied in, and on a ticket an internal note that reopens nothing - it matched a contact with no email address before. - Email-to-ticket: an address that's a contact at more than one client - someone who works for two, a shared mailbox - raised its tickets at whichever client the database gave first. It's the client whose domain it's at now, else the one they last raised a ticket at, and a note on the ticket names the others, to change its client if it's theirs. +- Mail queue: every email in a run went out with the first one's sender as its envelope sender - where bounces go - so an invoice sent after a ticket email bounced to the ticket mailbox, and a mail server that checks who may send as whom could turn it away. Each goes as itself now. ### Developer Updates @@ -147,6 +152,7 @@ Update from Maintenance > Update as usual - this release has eight database chan - Mail review stage 3: ticketMailSenderCheck() (functions/ticket_mail_auto.php) reads the topmost Authentication-Results - the receiving server's - and answers why it failed, or '': dmarc=fail with p= or policy= reject or quarantine, or Microsoft 365's action reject, oreject or quarantine; or spf=fail with no dkim=pass and no dmarc result; never with arc=pass or compauth=pass. Only a failure is acted on, so a pass a sender writes in gains nothing. cron/ticket_email_parser.php keeps it as the email's forged: addReply() makes a forged email a stranger's, with its own note, history and audit line; addTicket() takes $email (copied, message_id, automatic, dropped, forged) in place of its last four arguments, writes ticketMailForgedNote() (functions/ticket_mail_thread.php) and leaves out the copied-in CCs, the client-less ticket's CC and the answer for a forged one; the domain match makes no contact from one. ticketMailCreated() takes a subject, as ticketMailSend()'s subject; a client-less emailed ticket is answered "[REF] We have your email". - Mail review stage 4: a failed email is still being tried while it is under MAIL_QUEUE_TRIES and its last try is within MAIL_QUEUE_GIVE_UP_HOURS (24) - mailQueueRetryingSql(), mailQueueFailedSql() and mailQueueRetrying(), for the job, the tabs, an email's state, Cancel and the summary - so one given up on before the tries went from 4 to 8 stays Failed rather than being sent again, and Failed gives its own count of tries. mailQueueRefusedForGood() decides which refused recipients are for good: the enhanced codes 5.1.1, 5.1.2, 5.1.3, 5.1.6 and 5.1.10, or 550, 551 or 553 naming an unknown recipient from a server that gives none (MailQueueSmtp keeps code_ex). Any other refusal is tried again and counts toward the two-in-a-row stop. mailQueueNotifyAdmins() counts dismissed notices toward its hour. The job orders by email_bulk, then email_sensitive DESC. - Mail review stage 5: cron/ticket_email_parser.php - an email with no From address is from '' rather than itflow-guest@example.com: addReply() takes it as a stranger's ($no_sender) and addTicket() makes no CC and sends no answer. contactBounceClearEmail() runs after ticketMailSenderCheck(), and only when it didn't fail. ticketMailReplyTo() (functions/ticket_mail_auto.php) reads Reply-To: one at From's domain is taken as the sender ($via, shown as "sent by"); else, when ticketMailSystemSender() says From is a no-reply or website address (TICKET_MAIL_SYSTEM_SENDERS) or there is none, it is $answer - steps 4 to 6 raise the ticket with contact_id 0 for it at the From contact's or domain's client, or none. addTicket() makes the sender a CC whenever there is no contact (was: no client), answers anyone not a contact through ticketMailCreated()'s new $stranger (no Subject row and no button - its last parameter was the subject), and skips ticketMailColleaguesNew() for a forged ticket or one with no contact. ticketMailSenderContact() (functions/ticket_mail_thread.php) picks the contact for steps 3 and 4 by the From domain's client, then the latest ticket, then contact_id, and ticketMailSenderContactNote() notes the others; Try an Email uses it. An agent's email whose To or Cc has the ticket's contact, a CC or another of the client's contacts (ticketMailClientAddresses()) is a Public reply - addReplyAgentToClient() fills ticket_reply_emailed_to, calls setTicketFirstResponse(), assigns it through ticketChangeAssignee() under ticketReplyAssigns() or moves New to Open, and fires reply_reply_agent_public. ticketNotifyOwner() (functions/ticket.php) puts a bell notice with the assigned agent or the admins (appNotifyUsers(), functions/logging.php) - for bounces and closed-ticket replies, where appNotify() told every agent - and ticketMailAssigneeReplied() goes to ticketMailUnassignedReplied() on a ticket nobody has: the new-ticket address, else that notice. That covers portal and text replies too. +- Mail review stage 6: database 4.3.0 adds contacts.contact_unsubscribed_at and settings.config_mail_unsubscribe_secret. functions/contact_unsubscribe.php signs each contact's link with an HMAC of the contact id and address (contactUnsubscribeToken(), the key made on first use), and contactUnsubscribeSet() takes every contact with the address out or back in; contactUnsubscribedAddresses() is checked at send time, so a contact added since at another client is out too. guest/unsubscribe.php asks on GET, acts on its form's POST, and takes RFC 8058's List-Unsubscribe=One-Click POST with no page. emailBulkRecipients() (functions/email.php) builds the recipients from contact rows - the bounced, the unsubscribed, no address and the same address left out and counted - each with an unsubscribe link (emailHtml()'s new unsubscribe field) and its own List-Unsubscribe and List-Unsubscribe-Post headers (emailQueue() recipients' headers, let through by MAIL_QUEUE_HEADERS); emailBulkPost() now takes contact rows and converts Send at with timezoneFromView(). sendQueueEmail() sets the envelope sender per email - setFrom(..., false) with Sender reset, as PHPMailer's setFrom() kept the first email's From as Sender for the whole kept-alive connection - and for email_bulk passes mailQueueReturnPath(), the read mailbox when ticket parsing is on, the provider isn't Graph sending, the SMTP username is empty or that mailbox, and the domains align; a MAIL FROM refusal sends it again from the From address and sets mailQueueReturnPathRefused() for the run. mailQueueBouncesTo() tells the Email window. ## [26.12.2] diff --git a/admin/database_updates/4.3.0.php b/admin/database_updates/4.3.0.php new file mode 100644 index 000000000..7716603bc --- /dev/null +++ b/admin/database_updates/4.3.0.php @@ -0,0 +1,27 @@ + + +
Bulk email
+
+ + $unsubscribed_at]) ?> + = 2) { ?> + Subscribe again + + + Gets it + = 2) { ?> + Unsubscribe + + +
+
Ticket emails
diff --git a/agent/contacts.php b/agent/contacts.php index fa6dcd314..3aa53ab9c 100644 --- a/agent/contacts.php +++ b/agent/contacts.php @@ -153,7 +153,7 @@ if ($invites_view) { } } else { $sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS contacts.contact_id, contact_archived_at, contact_billing, contact_client_id, - contact_department, contact_email, " . contactBounceColumns() . ", contact_extension, contact_important, contact_location_id, contact_mobile, + contact_department, contact_email, " . contactBounceColumns() . ", " . contactUnsubscribeColumns() . ", contact_extension, contact_important, contact_location_id, contact_mobile, contact_mobile_country_code, contact_name, contact_phone, contact_phone_country_code, contact_photo, contact_primary, contact_technical, contact_title, contact_user_id, client_id, client_name, location_archived_at, location_name, user_auth_method FROM contacts @@ -631,7 +631,7 @@ $search_title = $invites_view ? 'Email, name or client' : 'Name, title, email, p
-
+
- diff --git a/agent/includes/bulk_email_fields.php b/agent/includes/bulk_email_fields.php index b606248af..a58eddd2c 100644 --- a/agent/includes/bulk_email_fields.php +++ b/agent/includes/bulk_email_fields.php @@ -5,7 +5,9 @@ * the mailbox it comes from, the name it shows, the subject, the message, a * greeting, and when to send it. They post what emailBulkSend() takes * (functions/email.php) - the email goes out in the email look, with the - * logo and the company's details. + * logo and the company's details, and a link to unsubscribe. Under From, + * where its bounces go (mailQueueBouncesTo()); Send at is on the agent's + * own clock (functions/user_timezone.php). * * Should not be accessed directly. */ @@ -13,6 +15,11 @@ isset($mysqli) || die("Direct file access is not allowed"); $bulk_mailboxes = emailMailboxes(); +$bulk_bounces = []; +foreach ($bulk_mailboxes as $key => $box) { + $bulk_bounces[$key] = mailQueueBouncesTo($box['email']); +} +$bulk_reads = (string) ($config_imap_username ?? ''); ?> @@ -29,10 +36,13 @@ $bulk_mailboxes = emailMailboxes(); + + +
@@ -64,25 +74,40 @@ $bulk_mailboxes = emailMailboxes();
- +
Leave it empty to send now.
+ +
+
+
Contacts marked Email bounced, and those who unsubscribed, are left out. Each email has a link to unsubscribe from email like this - ticket emails and invoices still go.