...
Expand | ||
---|---|---|
| ||
IMAP is a conversation between the client and the server. One opens up a TCP/IP stream. The server says “hello” and then the client says who they are and if the server accepts the proof of who the client says they are, then the client can ask the server to do various commands (ex. LOGIN, SELECT, FETCH, etc.)A TCP/IP stream gives guaranteed delivery of the order of data. Guaranteed means the TCP/IP protocol is designed to try and help the data reach the other side back and forth in a way that the data and order of the data is preserved. |
Expand | ||
---|---|---|
| ||
IMAP is a conversation between the client and the server. One opens up a TCP/IP streamThe client and server talk to each other using the language of IMAP. |
Expand | ||
---|---|---|
| ||
This is a common pattern with many TCP/IP protocols - it’s a way for the server to say - Hi - I speak your language and let’s begin a conversation. It’s like going up to someone and saying Hola! It signals you are ready for a conversation and that you speak Spanish. This is what we’d see say with a Gmail IMAP server:
This is IMAP for Hello! |
Expand | ||
---|---|---|
| ||
We need to Authenticate authenticate - usually with a user name and password. We send a LOGIN command which looks like this:
So IMAP messages start with a unique code for each message we send to the server. In this case a01 - this unique ID that we use to track the command we have sent so when we get a reply from the server then we know what the topic was. Notice the \r\n newline sequence? There is an interesting story behind that. Remember that question I asked you? |
Expand | ||
---|---|---|
| ||
Take special note of the a01 OK. |
Expand | ||
---|---|---|
| ||
The ID matches up with the ID we sent before as the client - so this is part of the conversation of telling the client whether the last command it sent was OK or refused NO, or was formatted incorrectly - i.e. BAD an error. So IMAP clients typically need a method of generating these IDs either randomly or in sequence. An IMAP client also needs a routine to read the data back from the client to get the data. |
...
Expand | ||
---|---|---|
| ||
Notice line 8 tells us we have successfully selected the INBOX.
|
Expand | ||
---|---|---|
| ||
|
Expand | ||
---|---|---|
| ||
Lot’s of commands are possible like getting a summary of an email (can be helpful to avoid loading a very big email). You can delete emails. You can probably filter on them. Ask Chat GPT - it knows a lot about IMAP |
...