Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up SendGrid using Django - User input "from_email"

All the Google searching in the world hasn't answered my question, so hoping someone can help me out.

I have a Django based "Contact Me" webpage, which uses a form and the Django send_mail function.

My app is hosted through Heroku.

When I try to submit an email on my form, the form tries send_mail(subject, message, from_email, ["[email protected]"]) But I get the following error:

(550, b'The from address does not match a verified Sender Identity. Mail cannot be sent until this error is resolved. Visit https://sendgrid.com/docs/for-developers/sending-email/sender-identity/ to see the Sender Identity requirements')

This seems to imply to me that the "from_email" needs to be MY verified email on SendGrid, and not the email of the person trying to contact me?

What am I missing? My goal is to have user submissions be sent to my @gmail.com address

like image 542
Ryan Wilkins Avatar asked Aug 14 '26 23:08

Ryan Wilkins


1 Answers

You need to get your 'from email' validated. You can find the documentation on sendgrid it self.

You can create a sender identity by doing a POST request on https://api.sendgrid.com/v3/senders using your API key. You can find more details on sender apis here:

https://sendgrid.com/docs/API_Reference/Web_API_v3/Marketing_Campaigns/sender_identities.html

like image 53
Ayush Pallav Avatar answered Aug 16 '26 18:08

Ayush Pallav