Sendgrid receive email locally

1.9k views Asked by At

I am trying to implement sendgrid parse API using the 'griddler' gem in my rails application. The problem is how can I test it locally? And how to receive email in my local machine.

2

There are 2 answers

0
Nick Q. On BEST ANSWER

The are a couple ways to test SendGrid's Parse Webhook locally.

The easiest is to just simulate the Webhook by POSTing data to your endpoint yourself (via cURL or some other mechanism, like Postman [example]). The SendGrid Parse Webhook Docs has an example of the payload that will be posted to your server, so you may mimic that.

The second option, which allows for end-to-end testing rather than just simulation is by creating a tunnel your local machine and provide SendGrid with the URL of the tunnel. There are a number of free services that allow you to do just that very easily:

0
Chuck Callebs On

If I may self-promote, I created a Ruby gem that does this:

https://github.com/ccallebs/pokey-sendgrid

It runs alongside your server and generates SendGrid webhook requests at regular intervals.