Ryan Wilkins
Ryan Wilkins

Reputation: 147

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

Upvotes: 3

Views: 1166

Answers (1)

Ayush Pallav
Ayush Pallav

Reputation: 1057

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

Upvotes: 2

Related Questions