from django.core.mail import EmailMessage class FixedEmailMessage(EmailMessage): def __init__(self, subject='', body='', from_email=None, to=None, cc=None, bcc=None, connection=None, attachments=None, headers=None): """ Initialize a single email message (which can be sent to multiple recipients). All strings used to create the message can be Unicode strings (or UTF-8 bytestrings). The SafeMIMEText class will handle any necessary encoding conversions. """ to_cc_bcc_types = (type(None), list, tuple) # test for typical error: people put strings in to, cc and bcc fields # see documentation at http://www.djangoproject.com/documentation/email/ assert isinstance(to, to_cc_bcc_types) assert isinstance(cc, to_cc_bcc_types) assert isinstance(bcc, to_cc_bcc_types) super(FixedEmailMessage, self).__init__(subject, body, from_email, to, bcc, connection, attachments, headers) if cc: self.cc = list(cc) else: self.cc = [] def recipients(self): """ Returns a list of all recipients of the email (includes direct addressees as well as Bcc entries). """ return self.to + self.cc + self.bcc def message(self): msg = super(FixedEmailMessage, self).message() del msg['Bcc'] # if you still use old django versions if self.cc: msg['Cc'] = ', '.join(self.cc) return msg