How sync works
in batches, without duplicates, without marking mail read.
Mail Desk keeps a copy of your mail in Perfex. This page explains when it reads mail, how much, what it sends back to the mail server, and what it never does.
01When mail is read
- Every Perfex cron run. Mail Desk goes through every active mailbox in turn (in order of their names) and reads new messages from the Inbox folder, then from the Sent folder.
- Sync now. The link under each mailbox in the Inbox's left column, and the button on each card in Mail Desk > Mailboxes, read one mailbox at once, with the same rules.
One cron run spends at most about 50 seconds on mail, across all mailboxes. Each mailbox reads at most one batch per run: 50 messages by default (Inbox and Sent together; Settings, 1 to 500). If more mail is waiting, or the time runs out, the next run continues where this one stopped. Mailboxes not reached because the time ran out wait for a later run; during a very large first import of one mailbox, the mailboxes after it in name order can be delayed (Large mailboxes).
If one mailbox fails (wrong password, server down), the others are still read. The error is saved on that mailbox as its last error and shown as Sync failed in the Inbox's left column (the text appears when you point at it), on the mailbox card in Mail Desk > Mailboxes and in the Dashboard's mailbox list. Two syncs of the same mailbox never run at the same time; a second one stops at once with "This mailbox is being synced right now. Try again in a minute."
Each connection waits up to 20 seconds for the mail server before it gives up.
02The first import
When a mailbox is new, Mail Desk reads the messages of the last N days from its Inbox and Sent folders. N is the mailbox's Import the last … days value: 30 by default, 0 for all mail, at most 3650. With 50 messages per cron run, a big first import takes many runs; the Inbox fills up from the oldest message in the window to the newest.
When the first import of a folder is finished, Mail Desk reads only mail that arrives after that point. Changing the number of days later does not fetch older mail for a folder that has finished its first import.
03Syncing never marks mail as read
Mail Desk opens each folder read-only and downloads messages in a way that leaves the server's "seen" flag alone (IMAP EXAMINE and BODY.PEEK). Colleagues who use the same mailbox in Outlook, Apple Mail or on their phone still see new mail as unread.
Mail is marked read only by a person: opening a conversation in Mail Desk marks its received messages read, and Mark as unread marks the latest received message unread again. There is no separate "mark as read" button. That change is then copied to the server (below).
04No duplicates
- Every folder remembers its
UIDVALIDITYand the last message number read, and progress is saved after every message. An interrupted sync continues without reading anything twice. - A message already stored (same folder position, or the same
Message-ID) is never stored again, even when it appears in another folder. - If the server renumbers a folder (a changed
UIDVALIDITY, for example after a server move), Mail Desk reads the folder again and recognises every message by itsMessage-ID. - Messages without a
Message-IDget a stable substitute built from sender, date, subject and size.
05How messages become conversations
- Reply headers first. A message whose
In-Reply-ToorReferencesheader names a message Mail Desk already has joins that conversation. - Subject as a fallback, for replies only. A reply whose headers point to nothing known (for example a reply to mail older than the import window) joins a conversation with the same subject (ignoring prefixes such as Re:, Fwd:, AW:, Odp:, SV:) and the same correspondent, from the last 30 days.
- Otherwise a new conversation starts, with status open and priority normal.
Dates come from the message itself, in your CRM's time zone. A message dated more than a day in the future is shown with the time it was received.
06Sending and the Sent folder
- The message leaves through the mailbox's own SMTP server, from the mailbox address. Recipients see it exactly as if it was sent from a normal mail program.
- A copy is saved in the mailbox's Sent folder on the server, marked as read, so it is also in Outlook, Apple Mail or Gmail.
- If the server cannot be reached at that moment, the message is still sent and the copy waits; the next sync saves it. If the server refuses the copy, Mail Desk tries again at the next syncs, up to 5 times.
- If no Sent folder is mapped, the message is sent but no copy is saved on the server, and Mail Desk shows a warning.
Many providers also keep their own copy of mail sent through their SMTP server. Because Mail Desk reads the Sent folder and recognises messages by their Message-ID, the reply appears once in the conversation.
07What is copied back to the mail server
Changes your team makes are queued and carried to the server at the start of the next sync of that mailbox, so a slow server never blocks the Inbox.
| In Mail Desk | On the mail server |
|---|---|
| Open a conversation | Its unread received messages get the "seen" flag. |
| Mark as unread | The latest received message loses the "seen" flag, as in most mail programs. |
| Move to trash | The conversation's messages that are in the Inbox folder move to the mapped Trash folder. |
| Archive | The conversation's messages that are in the Inbox folder move to the mapped Archive folder. |
| Send a message | A copy is saved in the Sent folder. |
| Restore from the trash, or Move to the inbox from the archive | The conversation's messages that are in the mapped Trash or Archive folder move back to the mapped Inbox folder. |
| Assign, status, priority, star, labels, notes, CRM links | Nothing; these exist only in Mail Desk. |
How restore finds the message. When Mail Desk moves a message to Trash or Archive, it remembers where the message is now: from the server's answer to the move (servers with UIDPLUS), otherwise by searching the destination folder for the message's Message-ID. If neither works (for example a message without a Message-ID on a server without UIDPLUS), Mail Desk cannot move that message back and it stays in Trash or Archive on the server, while the conversation is in the Inbox in Mail Desk. Messages that someone moved on the server with another mail program are not moved back either. A Trash or Archive folder that is not mapped means the server copy never left the Inbox.
If the server refuses a change, it is retried at the next syncs, up to 5 times, then dropped. If the server cannot be reached at all, the queue waits for the next run.
08Changes made in other mail programs
- Read and unread set in another program are picked up for the newest 200 messages of the Inbox at each sync.
- A message deleted or moved away on the server stays in Mail Desk; Mail Desk only notes that it is no longer in the Inbox, so later changes are not sent for it.
- Replies sent from another program appear in the conversation when the Sent folder is read.
09New mail on an existing conversation
- A conversation that is waiting or closed becomes open again when new mail from the other side arrives (setting Reopen a closed conversation when the customer writes again, on by default).
- A conversation in the archive or the trash comes back to the Inbox in Mail Desk when new mail from the other side arrives, whatever that setting says. Only the new message is in the server's Inbox; the older ones stay in Trash or Archive on the server.
10Size limits
| Limit | Default | What happens |
|---|---|---|
| Largest message | 25 MB | For a larger message only the headers are stored (sender, recipients, subject, date). The text and attachments are not downloaded; open it in your normal mail program. |
| Largest attachment | 15 MB | A larger attachment is not stored. Its name and size are listed in the message. The original stays on the mail server. |
| Keep attachments for | For ever (0) | When set, stored attachment files older than that many days are deleted by the daily clean-up. The message and the file name stay; the original stays on the server. |
All three are in Settings.
11What else the cron does
- Links conversations again: conversations from the last 30 days that are not linked to anyone are checked again, so mail from someone who became a contact or a lead later still lands on their record.
- Releases stuck drafts: a draft whose send was interrupted more than 15 minutes ago can be sent or discarded again.
- Once a day: deletes old attachment files (only when Keep attachments for is set) and forgets "who is viewing" entries older than a day.