Closed sklarsa closed 3 years ago
@alichass Are you attaching Personalization
objects to the EmailMessage
when constructing it, or dict
s? I'm wondering if we need to support both..
so currently the personalizations attribute needs to be set as such in order to be used (basically correctly formatted EmailMessage Attributes):
email = EmailMessage(from_email="hello@github.com", to=["goodbye@github.com"])
email.personalizations=[
{"to": ["_to_email_addr_1"], "bcc":[...] "dynamic_template_data": {...}, ...},
{"to": ["_to_email_addr_2", "_to_email_addr_3", ...], "bcc":[...] "dynamic_template_data": {...}, ...},
...
]
If you use EmailMessage.send() be sure to construct the EmailMessage with an arbitrary to
- don't worry it wont be used
Closed by #93
Hi @sklarsa sorry I forgot to mention something important The .personalizations attribute obviously contains the "to" address for each personalization.
This may make it seem like setting the "to" attr on the EmailMessage is unnecessary. It is unnecessary in most cases, eg when using
mail.get_connection().send_messages()
; however, the implementation of EmailMessage.send() does a check for self.recipients(), which means an arbitrary "to" must be set - even if it will not be used, if the given function is to be usedOriginally posted by @alichass in https://github.com/sklarsa/django-sendgrid-v5/issues/90#issuecomment-892874816