POP3/IMAP Servers¶
The POP3/IMAP Servers screen holds the mailboxes IMan reads inbound email from. The Email controller reads a reader's input from a record here. The Email Task uses a record to download attachments, delete mail, mark mail read and move mail between folders. Sending mail uses a different screen, SMTP Servers.
Each record is an account on one mail server. Two choices on the record decide the rest of its form.
Mailbox Protocol¶
How the mail is retrieved. The two protocols differ in what IMan can remember about the mailbox, and that decides how an integration avoids processing the same email twice.
| POP3 | IMAP | |
|---|---|---|
| What is read | The inbox only | Any folder the account has, chosen on the reader or task |
| What IMan remembers | Nothing. A run sees every matching email in the inbox | Where each reader has got to, as a read position kept in IMan's database |
| Not processing an email twice | Delete it — Delete From Server on the reader, or a Delete Email task | A Mark Email Read task advances the position; the mail can stay, or a Move Email task can file it |
| Default ports | 110, or 995 over TLS | 143, or 993 over TLS |
Choose IMAP unless the mail server offers only POP3. With IMAP, mail stays where it is, you can re-run an integration against it, and an integration can file what it has processed into folders. Choose POP3 only where the server offers nothing else, and build the integration to remove what it reads.
The protocol is set per record, and a reader or task follows the record it names. Point a reader at an IMAP record and its Setup tab gains the folder, the preview window, the batch size and the read position. Point it at a POP3 record and those controls are not drawn.
Email Type¶
How IMan authenticates to the account.
- POP/IMap (Username) — a host name, a port and a username and password. Any mail server that accepts a plain login, including Office 365 accounts where basic authentication is still allowed.
- Office 365 (OAuth) — an Office 365 mailbox reached through an Azure app registration and an OAuth consent. The host and port are Microsoft's, so you do not enter them. You authorise the record after saving it, and the consent it asks for depends on the Mailbox Protocol.
The grid's Server Type column shows this choice, as the form labels it.
Id and Description¶
The Id names the record, up to twelve characters, and you cannot change it once saved. The Description, up to sixty characters, is the text the Email Server and Email System drop-downs in the Designer show. Make it say which mailbox this is, not repeat the Id.
Retry Settings¶
The retry settings at the foot of the form decide how IMan handles a mailbox call that fails for a reason that may pass, such as a dropped connection or a mailbox that another client has locked. They apply to POP3 and IMAP, with either Email Type.
Custom retry settings decides where the values come from. Unticked, IMan uses its defaults for a mail server, shown greyed in the boxes. A later release that improves the defaults changes an unticked record too. Tick it to edit the boxes and keep your own values on this record.
- Retries: how many times IMan retries a failed call before it reports the error, from 0 to 5. 0 turns these retries off.
- First delay (seconds): the wait before the first retry, from 1 to 60.
- Maximum delay (seconds): the longest wait between retries, from 1 to
- It cannot be less than the first delay.
Each wait is double the one before, up to the maximum delay. IMan varies every wait by up to a quarter either way. That keeps many callers from retrying in step.
The defaults for a mail server are 3 retries, a first delay of 2 seconds and a maximum delay of 10 seconds. The waits are then about 2, 4 and 8 seconds.
What IMan retries¶
Before each retry IMan reconnects. It opens a new session, logs in and, over IMAP, selects the folder again. Then it repeats the call.
Over IMAP, IMan retries:
- any failure that leaves the session disconnected, including a connection IMan cannot open;
- the server ending the session with
BYE; - the replies
[UNAVAILABLE]and[INUSE].
It never retries [AUTHENTICATIONFAILED], [AUTHORIZATIONFAILED],
[NONEXISTENT], [TRYCREATE], a BAD reply, or any other refusal on a
working session.
Over POP3, IMan retries a connection it cannot open or that has dropped,
and the replies -ERR [IN-USE] and -ERR [SYS/TEMP]. It never retries
[AUTH], [SYS/PERM] or any other -ERR.
A repeat never acts on the wrong mail:
- A POP3 delete that finds the message already gone counts as done.
- After an IMAP reconnect, IMan checks that the server has not renumbered the folder before it moves, deletes or flags mail it read earlier. If the server has renumbered it, IMan stops: The folder [Orders] has been renumbered since the mail was read; it was read under UIDVALIDITY [1700000000] and the folder now reports [1700000123]. The mail must be read again.
If IMan cannot fetch a POP3 message because of a temporary failure, the read fails once the retries run out. A message the server refuses outright is skipped, and the read carries on.
With Office 365 authentication, the access token request has fixed retries of its own: 3, after about 1, 2 and 4 seconds, when the token service is throttling or failing. They apply whatever Retries says.
What you see¶
When a retry succeeds, the run carries on as if nothing had failed. Each retry writes a line to the trace of the reader or Email task:
When the retries run out, IMan reports the last error with the count added,
such as (after [3] retries), and the usual error handling applies. From then
on, each call on the same connection gets one attempt and no retries until a call succeeds.
A server that is down then fails the remaining work quickly, rather than
holding up every record for the full retry time.
IMan makes no retries in the Designer. A preview, or Test on this screen, reports the first failure at once.
A reader's read and each server delete use connections of their own.
Changing a saved record¶
You can edit a record at any time, and every reader and task that names it picks up the change on its next run. Take care with two changes:
- Switching the Mailbox Protocol on an Office 365 account clears the tokens the account holds, and you must authorise the record again before it can connect. The form warns you before you save. Consent is granted for one protocol's scope, and a token issued for POP3 does not work over IMAP.
- Switching the protocol under an existing reader changes what the reader's Setup tab offers, as above. A reader moved from POP3 to IMAP starts with no read position, so its first run sets one at the newest mail and processes nothing. See the read position on the Email controller page.

