Django SendGrid Integration on heroku

Hi!

I am using SendGrid add-on on heroku for my Django application to send out emails.
I am using API client of SendGrid.
I setup the account, the account is activated, added verified senders and created API keys.
The problem is sending emails works well on my local dev environment but it gives me HTTP Error 404: Forbidden on heroku app.
I am not sure what the problem is and even not sure how I can debug this problem.
Does anybody here have experience in using SendGrid API for Django app hosted on heroku.
Any help would be appreciated.

I suspect your credentials aren’t set up properly on Heroku. I use SendGrid for my side project which is hosted on Heroku. I was successful with SendGrid and used Django Anymail to get things working. I definitely recommend that package.

Anymail is well documented for a lot of email service providers.

https://anymail.readthedocs.io/en/stable/

Hi!

What did you mean by credentials?
I am using API client of SendGrid, not SMTP.
And I have correct API key on heroku settings.
I think if credentails are not correct, then I should get HTTP Error 401: Unauthorized
But now I am getting 403: Forbidden.

I meant API key for credentials. I’m not using SMTP either since Anymail integrates directly with the SendGrid APIs.

I’m not sure why you’d get a Forbidden message. Sorry I can’t be of more help. I don’t know your usage case, but Anymail might be worth trying if you’re attempting to send emails through Django’s standard mail interface.

Heroku is pretty locked down. You have to use an addon to send mail. They are incredibly strict and unhelpful in terms of support or questions–at least with SG. Expect to get macro’d by people who don’t read the ticket.