Managing emails from a client MUA
Email clients (Mail User Agent/MUA) such as Mozilla Thunderbird, Roundcube or K-9 Mail do an amazing job of hiding the complexities of managing our emails. This brief article is an attempt at shining a light on how these clients work with an IMAP server to manage email.
When you create an email and then send it, a number of things happen:
- The email is sent to your ISP using SMTP;
- A copy of the email is stored using IMAP to your sent folder.
Often an email is put into an outbox prior to delivery, but the delivery mechanism is the same.
The sent folder is configurable and as there are no standards, each application has its own default setting for drafts, sent, templates and trash. If there isn't a default it won't get saved!
When you drag and drop an email from one folder to another:
- The email is copied using IMAP to the new folder, this can be on the same or a different server
- The original email is marked as deleted
There are apps such as imapsync that can be used to migrate IMAP accounts between servers or to backup IMAP accounts.
When you mark an email as read or to be deleted, IMAP is used to update the email with that information.
Synchronising between clients
We live in an always connected world. Often, multiple email clients need to coordinate changes to a common IMAP mailbox. Examples include users with both mobile and desktop, different clients working on behalf of the same user and multiple users accessing shared mailboxes. These clients need a mechanism to efficiently synchronize state changes for messages within the mailbox.
DBMail implements IMAP Extensions: Quick Flag Changes Resynchronization (CONDSTORE) and Quick Mailbox Resynchronization (QRESYNC) to enable email clients to take advantage of these efficiencies.
With the current volume of emails, it's useful to automatically filter emails. Sieve filtering can be used to place emails in folders, reject or discard emails, and forward an email to another user.
Many email clients implementing Sieve filtering analyse an email and offer a point and click way to identify relevant aspects of an email, choose what action should be taken, and create or amend a script to automate that action. dbmail-sieved implements a sieve server so email clients can manage Sieve scripts. On receipt of an email, dbmail-deliver and dbmail-lmtpd can take any action defined in a user's Sieve script.