1) You can use IMAP keywords functionality to assign keywords (or tags) to mail messages. Using this to store arbitrary data is not really possible.
2) You can add extra information into custom headers of an e-mail – these are preserved and stored in its message database by Microsoft Exchange Server (Edit: See the comment).
However, adding a custom header using the IMAP protocol is very problematic – IMAP doesn't make it possible to modify a message at the mail server, so the only way to add a header is to:
- Download the message from the server.
- Add the header to the downloaded message.
- Upload the message back to the server.
- Delete the original message.
The problem with this is that we are not actually modifying a message, but creating a modified copy of it. This means that any Exchange-only properties associated with the message (which are not accessible using the IMAP protocol) will disappear. This might be undesirable.