Need an example of a POP3 Server or IMAP Server written in Python

WeNeedAnswers picture WeNeedAnswers · Nov 18, 2010 · Viewed 10.3k times · Source

Experimenting with Application Messaging over email for Applications. I have already created my SMTP Server but now missing a centralised delivery mechanism. I can create a propriety delivery mechanism very easily but I am trying to use protocol standards. I am not interested in HTTP, FTP or SOAP but only the mail protocols.

I have looked around the net for python examples, so far no luck. I don't want to spend too much time and effort into this, as its only a technique field study for the moment, to see if async delivery over an email system is a viable approach to communications between applications. I know about sendmail solutions and I am not interested in this, as the solution needs to be a full on Python solution, using "batteries" where possible, or maybe Twisted if I really have too.

The only two standards I have looked into thus far is IMAP and POP. I still can't believe that in this day and age we require two protocols for mail sending and delivery, if there is anything out there that does the two in one (Protocol that is) I would be most happy to look into it.

After further investigation, I think that the only viable option would be twisted, any help with this would be great

update Gave up on the POP/IMAP Server, its all a little bit too much work for very little reward. However, I used an "off the shelf" server solution that serves up email as IMAP4 and sends out as SMTP. Now that I have found this, I will continue my investigation of Application Services over Email. So far created an application that downloads RSS feeds and emails them in html format. The emails are filtered for content I am interested in by a server application written in Python. Next stage is a DSL language to communicate with a server, bit like telnet over email. Should be fun. After that RPC over Email between multi applications.

Answer

Gintautas Miliauskas picture Gintautas Miliauskas · Nov 18, 2010

Edit: A simple example of a POP3 server can be found here: http://code.activestate.com/recipes/534131-pypopper-python-pop3-server/ You will have to replace the message serving mechanism, but you would need to do that anyway. For an IMAP server implementation using Twisted, see https://github.com/davglass/twimapd .

If you want email, then you're looking at SMTP, POP and IMAP. That's what email is by definition.

Actually, for delivery, SMTP should be enough; POP/IMAP is for retrieval and is not really that useful if your applications can always connect to each other directly.

If you don't need to use email specifically, you might want to look into alternative protocols, such as XMPP (Jabber): http://en.wikipedia.org/wiki/Extensible_Messaging_and_Presence_Protocol