IMAP Concepts

IMAP is a surprisingly simple protocol to implement, particularly in an environment like the Developing in the Translator. Here are some basic concepts:

It’s a protocol intended to let a email program communicate and get email from a email server.

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.

IMAP is a conversation between the client and the server. The client and server talk to each other using the language of IMAP.

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:

* OK Gimap ready for requests from 69.196.142.158 ql9mb2511069qvb

This is IMAP for Hello!

We need to authenticate - usually with a user name and password. We send a LOGIN command which looks like this:

a01 LOGIN aryn.wiebe@interfaceware.com lkjllkjddkdjsfdhgh\r\n

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?

 

Â