Fully functioning email client in Python

Jorgen Grahn grahn+nntp at snipabacken.se
Sun Feb 6 13:41:37 EST 2011


On Sun, 2011-02-06, iaoua iaoua wrote:
...
> In a nutshell my problem is this. I have
> developed an intelligent conversational agent which dialogues with a
> user to find out what they are really searching for. The domain is
> open and helps the user find which businesses/websites offer the
> services or products the user is looking for according to needs
> elicited from the user during the dialogue. I have small but growing
> base of experimental users who want to access the agent via email (the
> agent can be quite slow at times due to the complexity of the system)
> so that they can ask questions and forget about them until an answer
> comes to their inbox.

OK, so the "agent" becomes a server with a mail interface.

> And so I need to extend my agent so that it can
> receive and send emails and extract the relevant text answers to
> questions from the user. This requires full threading capabilities and
> automatic text extraction of only the new and relevant material (minus
> signatures of course).
>
> Now, I'm not completely lazy and so I have already done a little
> homework. I've been reading O'Reilly's Programming Python and
> Foundations of Python Network Programming which have both been very
> helpful in ascertaining that Python is a strong candidate solution.
> Both books talk about the email (for message and header construction
> and parsing) sendmail (for sending mail via SMTP) and poplib (for
> receiving mail with POP3) libraries.
...
> What I really need is a ready made fully functional Python client that
> already has it that offers me a simple interface to extract text from
> received messages along with a message id that I can use to associate
> the response to a question with and allows me to send out new
> questions or answers along with a message id I can use to track future
> responses with. I need something that already has the whole shebang.
> Can support POP3, IMAP, SSL authentication, message threading etc.
>
> Can anyone point to something that will save me the effort of building
> this thing from scratch and first principles? Thanks in advance for
> any useful suggestions.

I imagine your only worry is the server side. What are your
requirements on the system it's running on?

If it's on Unix you don't need to do any network programming at all,
and can forget about IMAP, POP3, SSL and SMTP.  Using procmail you can
arrange to start a program of your choice each time a mail arrives
(and that program would put the message on your agent's work queue).
To send mail, you feed the text and the recipient address into
/usr/lib/sendmail.

If you build the interface on POP3 and SMTP, you have to bypass the
system's builtin mail capabilities.

If on the other hand it's on Windows, there's certainly some very
different scheme you have to follow (or bypass).

/Jorgen

-- 
  // Jorgen Grahn <grahn@  Oo  o.   .  .
\X/     snipabacken.se>   O  o   .



More information about the Python-list mailing list