Ticket #7722: mail.diff

File mail.diff, 1.5 KB (added by roberto.digirolamo <robydigi91@…>, 16 years ago)
  • django/core/mail.py

     
    194194    multipart_subtype = 'mixed'
    195195    encoding = None     # None => use settings default
    196196
    197     def __init__(self, subject='', body='', from_email=None, to=None, bcc=None,
     197    def __init__(self, subject='', body='', from_email=None, to=None, cc=None, bcc=None,
    198198            connection=None, attachments=None, headers=None):
    199199        """
    200200        Initialize a single email message (which can be sent to multiple
     
    208208            self.to = list(to)
    209209        else:
    210210            self.to = []
     211        if cc:
     212                        self.cc = list(cc)
     213                else:
     214                        self.cc = []
    211215        if bcc:
    212216            self.bcc = list(bcc)
    213217        else:
     
    241245        msg['Subject'] = self.subject
    242246        msg['From'] = self.from_email
    243247        msg['To'] = ', '.join(self.to)
     248        if not self.cc == None:
     249            msg['Cc'] = ', '.join(self.cc)
    244250        msg['Date'] = formatdate()
    245251        msg['Message-ID'] = make_msgid()
    246252        for name, value in self.extra_headers.items():
     
    250256    def recipients(self):
    251257        """
    252258        Returns a list of all recipients of the email (includes direct
    253         addressees as well as Bcc entries).
     259        addressees as well as Bcc and Ccentries).
    254260        """
    255         return self.to + self.bcc
     261        return self.to + self.cc + self.bcc
    256262
    257263    def send(self, fail_silently=False):
    258264        """Sends the email message."""
Back to Top