2

Currently sending emails with Django, and was wondering if there was any way to periodically check my inbox with Django (or ideally somehow alert the server upon receipt of a new email), and have Django extract the message and save it in the database.

Jeffrey Steven
  • 185
  • 1
  • 8
  • 2
    Check out [imaplib](http://docs.python.org/2/library/imaplib.html) and [poplib](http://docs.python.org/2/library/poplib.html). – xyres Feb 15 '16 at 21:26
  • And here's an answer: http://stackoverflow.com/a/8669293/1925257 – xyres Feb 15 '16 at 21:27
  • Possible duplicate of [Get emails with Python and pop lib](http://stackoverflow.com/questions/8669202/get-emails-with-python-and-pop-lib) – Sayse Feb 15 '16 at 21:29

1 Answers1

0

You could use an email service such as SendMail or Mandrill (latter definitely has free accounts, former may have).

Each of these services provide inbound email support via webhooks. You provide them an endpoint to hit (make sure to use HTTPS) and when they receive an email to an address you have registered they will send the data via HTTP POST to you.

It is then just a simple case of storing this data to the database. There are a number of 3rd party packages that can help you with this:

http://djrill.readthedocs.org/en/v1.4/usage/webhooks/

https://github.com/yunojuno/django-inbound-email

https://github.com/jpadilla/mandrill-inbound-python

https://github.com/michaelhelmick/python-mailsnake

Although it's rather simple to roll your own should need be.

xxx
  • 1,465
  • 1
  • 14
  • 23