I am about to try and write my own email server. I want to be able to receive emails directly from other email gateways using SMTP, store the messages and then download the emails via POP.

I have not been able to find any examples anywhere on the net to do this.

Does anyone know of any resources that may help me with this task, tutorials, source code, specifications etc.

Thanks in advance.