By continuing to navigate on this website, you accept the use of cookies to serve you more relevant services & content.
For more information and to change the setting of cookies on your computer, please read our Cookie Policy.

Sendgrid Inbound Email Parsing with django

Using the Inbound parse webhook, we can parse the contents, attachments of an incoming email. 

Inbound Parse API follows 3 steps:

1. sending an email to the mail id(URL_Name@your specified domain/sub domain.com)

        a Here the domain/ sub domain, where the emails will be sent, and the URL_Name, where we will handle the contents, attachments of an incoming email in our app. 

        b. Here the domain/sub domain should point out the MX record to mx.sendgrid.net. Here http://mxtoolbox.com/ you can check weather your domain/ sub domain is having MX  record or not.

        c. we should add domain/ sub domain, URL to our inbound parse webhook settings list.

         For ex:
             domain: reports.micropyramid.com
             url: https://micropyramid.com/reports/
             mail id: reports@reports.micropyramid.com

2. Sendgrid parses the content and attachments of an email and sends the information to the specified URL of your application.

3. You can receive the JSON post response to your application
         envelope = request.POST.get('envelope')
         my_dict = literal_eval(envelope)

      You can get email from address form my_dict['from'], text(request.POST.get('text')), attachment details from request.POST.get('attachment-info').

In order to test it in local server, You can use the following settings:

        domain: your_domain_name.bymail.in(bymail.in is having an MX record)
        URL: Your App Url
        mail id: URL_Name@your_domain_name.bymail.in

 

    Posted On
  • 08 May 2014
  • By
  • Micropyramid

Need any Help in your Project?Let's Talk

Latest Comments
Related Articles
Understanding Django model formsets in detail and their advanced usage.

Silmilar to the regular formsets, django also provide model formset that make it easy to work with django models. Django model formsets provide a way ...

Continue Reading...
Integration Of GitHub API with python django

Using Github integration, we can get the user verified email id, general information, git hub URL, id, disk usage, public, private repo's, gists and followers, ...

Continue Reading...
Dynamically Adding Google Maps with Marker In Django

Google Maps allows you to display maps on your web site, we can also customize maps, and the information on maps.
The Google Maps API ...

Continue Reading...
open source packages

Subscribe To our news letter

Subscribe and Stay Updated about our Webinars, news and articles on Django, Python, Machine Learning, Amazon Web Services, DevOps, Salesforce, ReactJS, AngularJS, React Native.
* We don't provide your email contact details to any third parties