PythonAnywhere Forums

Incoming email

What solutions have people on PA used for processing incoming email? My app runs on django, and I would like to process incoming emails. I am not sure if I can pipe directly to a script, or if I will have to access a 3rd party mail server. I am curious to hear what others have done.

Just an answer from the dev team here to get the ball rolling... You'll need to have a 3rd party mail server. There are two options:

  • A traditional email server running POP3 or IMAP. This is a "pull" protocol, so you'll need to write a scheduled task to poll it and pull down any waiting emails periodically.
  • A web service that does webhooks to notify you of incoming emails. I remember hearing from someone who was using something like this, but unfortunately can't find the details. Basically, you set it up to receive emails for your domain, and then when one arrived, it hit a URL that you defined. So you could set up a URL on your web app so that when it was pinged by the service, it did appropriate stuff.

Anyway, that's what's possible in theory, as far as I know. Hopefully other people can chime in and say how they're doing it in practice :-)

I also need to use traditional email server IMAP, a "pull" job to be scheduled to retreive any waiting emails periodically. But I can't install the imaplib with pip install imaplib :-(

.

10:31 ~ $ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)  [GCC 4.8.2] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
10:31 ~ $ pip install imaplib Collecting imaplib
   Could not find a version that satisfies the requirement imaplib (from versions: ) 
No matching distribution found for imaplib 
10:31 ~ $ pip install --user imaplib Collecting imaplib
   Could not find a version that satisfies the requirement imaplib (from versions: ) 
No matching distribution found for imaplib 
10:32 ~ $

Any idea ?

[edit by admin: formatting]

u don't need to install imaplib (it's part of the python standard library).

+1 to what bfg says. You should be able to use it without installing it.

yep, works fine - many thanks