How to allow all IP addresses to send emails from Twillio SendGrid?

Viewed 1339

I'm trying to integrate SendGrid with Nextjs as mentioned in this post, everything works fine locally. I can send mails using SendGrid with status code 202. But when I deploy it to vercel it blocks IP from vercel and thus I get "Unauthorized" as a response from SendGrid I verified it from vercel. Here is the Screenshot from the SendGrid IP access management section.

enter image description here

All these blocked Ip logs are of my production deployment from vercel when I try to send an email through the production version of my app. Now there's an option to whitelist an IP or IP range in SendGrid but the Ip address of vercel's deployment is not static and thus I can't whitelist a single IP address, is there any way I can whitelist all IP addresses in SendGrid? I have also tried to integrate SendGrid API using @sendgrid/mail library but again having the same error.

Any help is appreciated thanks.

1 Answers

Have you tried disabling IP Allow listing from sendgrid IP Access Management.

This will allow connections from any IP Address.

More info from Vercel here about allowing all IP Addresses -

https://vercel.com/support/articles/how-to-allowlist-deployment-ip-address

They suggest using the IP Address 0.0.0.0 but I found this didn't work whereas disabling IP Allow listing did the trick.

Related