First of all, congratulations for your job with this package! It has been really helpful using it!
While sending emails, I realized that Django's EmailMessage doesn't attach the bcc recipient's to the message, and it instead uses separately the recipients() which works good with other backends like smtp.
To workaround that, I made a small change on GmailBackend.send_message. If you find useful, I can open a new pull request to update the package
Thanks
Rodrigo
class GmailBackendWithBcc(GmailBackend):
def send_message(self, email_message):
if not email_message.recipients():
return False
message = email_message.message()
if email_message.bcc:
email_message._set_list_header_if_not_empty(message, 'Bcc', email_message.bcc)
raw_message = {'raw': base64.urlsafe_b64encode(message.as_bytes()).decode()}
return self.service.users().messages().send(userId=self.user_id, body=raw_message)
Hi guys! How are you doing?
First of all, congratulations for your job with this package! It has been really helpful using it!
While sending emails, I realized that Django's
EmailMessage
doesn't attach the bcc recipient's to the message, and it instead uses separately therecipients()
which works good with other backends like smtp.To workaround that, I made a small change on
GmailBackend.send_message
. If you find useful, I can open a new pull request to update the packageThanks Rodrigo