sklarsa / django-sendgrid-v5

An implementation of Django's EmailBackend compatible with sendgrid-python v5+
MIT License
323 stars 54 forks source link

Categories #38

Closed JoenyBui closed 6 years ago

JoenyBui commented 6 years ago

How do I add categories to the email?

I tried something like this but no dice.

EmailMessage(subject=subject, body=message, from_email=sender, to=[recipient, ], headers={'categories': 'dev'})

Any thoughts?

sklarsa commented 6 years ago

Categories should be a property on the mail object (not included in the headers) as per the docs here: https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/index.html

So to use in this library, you would need to do something like this

msg = EmailMessage(...)
msg.categories = ['dev`]