IMAP Server Project

From COEP Wiki
Jump to: navigation, search

Getting inspiration

Install Alpine or Mutt (email clients) to see how they work.

Setup

The first thing you need to do is to setup Postfix(Mail Server) and Dovecot(IMAP Server) on your machine.

I would mention one more link for the above mentioned procedure => setup_link_video.

Next test your Dovecot's installation. If everything's working well, you're all set! If not, check whether you did the installation steps correctly and some troubleshooting will help.

You can also install other IMAP servers like Courier but Dovecot is fast, lightweight and efficient and hence recommended. Dovecot also supports SSL in case you choose IMAP/SSL.

Note: Check the Dovecot server before running your code. Make this a habit throughout the project development! It is a good practice.

Working

Check out IMAP 3501 RFC. You need not read the document line by line but check the commands and their respective responses. Note that for testing Dovecot installation you used these commands and saw their responses in action. Throughout your working you'll need to refer these, so keep them bookmarked.

If using Python, you should preferably not use inbuilt libraries like imaplib. Use the socket library for connecting to the IMAP server. Parse the responses which you get after running the commands.

Keep checking Wireshark for IMAP packets if there is some trouble in connections or a bug in code.

For talking witht the Dovecot IMAP server, you can telnet to port 143 at localhost. You can use this to try out various commands by referring IMAP 3501 RFC.

For sending mail you can telnet to port 25(SMTP).

My recommendation to you would be to first try all the possible commands (that are relevant to your project) by taking reference from IMAP 3501 RFC. First try these commands by telnetting to 127.0.0.1:143 and observe the responses for different scenarios. Then proceed to writing the raw code just to implement all the commands that you learnt! Once you do this, then you can proceed to writing the actual code that is exepcted by the project.

Note: Important alert! This is the problem I faced, whenever you send a message(i.e. a command) to the server make sure your command has a carriage return and line feed (i.e. \r\n) at the end of the command line. If you forget to put that in, then the server won't send any reply because it couldn't understand your command at the first place which was due to the absence of \r\n at the end of the command. In case everything is working alright and your configurations of Dovecot are also upto mark, but still you aren't getting any reply from the IMAP server then please check the status of the Dovecot server by doing running "systemctl status dovecot" as a sudoer

Tip: Don't wait for all of the things to get cleared. Just start working with your project, you'll figure out things as you move on. Tip: Don't keep searching from help from peers! The best way to get through the project will be you yourself figuring out things.