On Tue, Mar 3, 2009 at 2:36 PM, Ville Säävuori <vi...@syneus.fi> wrote:
>
> I'm playing with an web hook webapp called smtp2web ( http://smtp2web.com
> ), which, as it name suggests, forwards email messages to a URL as a
> http POST request.
>
> A quote from docs: "the entire message (including headers) is sent in
> a POST request to the URL you specified, with Content-Type: multipart/
> rfc-822. In addition, the query parameters "from" and "to" are set to
> the envelope sender and recipient, respectively".
>
> Example code uses Google App Engine wsgi request handler and parses
> the email like this:
>
> message = email.message_from_string(self.request.body)
>
> Turns out, this seems to be quite a bit harder to do in Django,
> though. Django parses the request automagically into a easy to use
> Request class, but unfortunately it also loses all multipart data that
> is not multipart/form-data. (Or have I missed something?)
>
> A helpful Djangonaut pointed out to me in IRC that I could subclass
> the request handler (in my case django.core.handlers.modpython) and do
> some magic to prevent the default handling from happening. Is this the
> only way to get to this data? I'd like a cleaner (and easier!)
> solution for this seemingly trivial problem.
> I also found one related ticket, opened two years ago and still open:
>
> http://code.djangoproject.com/ticket/3211
>
> - VS
> >
>

Perhaps you're looking for request.raw_post_data ?
http://docs.djangoproject.com/en/dev/ref/request-response/#attributes
(towards the bottom)

You'd have to do the processing yourself, but this should give you the
original request body.

Colin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to