Sendgrid how to track an individual email address

I am sending emails via sendgrid and want to track the status of the email.

client = sendgrid.SendGridClient(username_or_apikey=my_key)
msg = sendgrid.Mail()
msg.add_to('a@foo.com')
msg.set_html('<div> hello there </div>')
msg.set_from('b@foo.com')
msg.set_subject('test sendgrid subject')
resp = client.send(msg)

      

The response object I am returning is simple (200, '{"message":"success"}')

. I was hoping to get some of the email back.

I know sendgrid has webhooks , but how do I bind sg_message_id

to the email I sent?

+3


source to share


1 answer


You can generate unique arguments for each mail that go into the JSON string for the SMTP API and are included in status messages for websites.



More information on this page: https://sendgrid.com/docs/API_Reference/SMTP_API/unique_arguments.html

+1


source







All Articles