zweb wrote: > i can send emails easily using django. > > I want to set up an email address, where users can send email to the > app (designated email address) and my django application receives it, > parses it and stores it in database. > > What would be the easiest way to do it. ie " To receive email from > users in Django application"
There was a thread about this a few months ago. Here are some options
you have:
On your mailserver, if you run your own, you can set up an alias that
will actually send the messages to a command via a pipe.
superwebapp: "|/path/to/my/pythonscript.py"
The script will receive the message verbatim. You can use Python's
'email' module to parse out the sender, body, attachments, etc. This is
the solution that I've worked with, and it works well if you run your
own postfix server. This type of script will likely be useful if you use
the postfix pipe method or one of the other two methods. The code will
be the same once passed into a Python string.
Another option is to run a python daemon using the 'smtpd' module. It
essentially is its own mailserver, and can process incoming mail in
native Python. I've never used it, but it seems like a good option for
some setups. You just need to set it up so that mail at that address
will get to that server. I haven't set this up, but I'd be willing to
bet that this is easiest if you have a dedicated webserver that hosts
your app that is separate from your domain's mailserver.
The third option is to use an imap or pop library and download the
messages that way. Python has the 'imaplib' module for imap, and
'poplib' for pop3. I haven't implemented this either. I'd be willing to
guess that this is easiest if you have a shared host, or don't run your
own mailserver.
Take Care!
Jeff Anderson
signature.asc
Description: OpenPGP digital signature

