Python sendmail with Cc
<p>I already programmed a function which sends mails with atachments, images on text and other things, but now I need the function to use de Cc (Carbon Copy) function in order to send copies to different emails.</p>

<p>I have done some changes on the function and it works but not as I want. </p>

<p>THe email is sent to the address ("toaddr") and the mail shows that there are other emails added as Cc("tocc") emails, but the Cc emails do not recieve the email. </p>

<p>To be more clear (because I think I am not being very clear) here is an example:</p>

<pre><code>Sender: from@hotmail.com
Receiver: to@hotmail.com
Copied: cc@hotmail.com

to@hotmail.com receives the email and can see that cc@hotmail.com is copied on it.
cc@hotmail.com does not get the email.
if to@hotmail.com reply to all the email, THEN cc@hotmail gets the email.
</code></pre>

<p>Can anyone help me telling me what do I need to change on the function?? I guees the problem is with the <code>server.sendmail()</code> function</p>

<p>This is my function:</p>

<pre><code>def enviarCorreo(fromaddr, toaddr, tocc, subject, text, file, imagenes):
    msg = MIMEMultipart('mixed')
    msg['From'] = fromaddr
    msg['To'] = ','.join(toaddr)
    msg['Cc'] = ','.join(tocc)         # &lt;-- I added this
    msg['Subject'] = subject
    msg.attach(MIMEText(text,'HTML'))
    #Attached Images--------------
    if imagenes:
       imagenes = imagenes.split('--')
       for i in range(len(imagenes)):   
        adjuntoImagen = MIMEBase('application', "octet-stream")
        adjuntoImagen.set_payload(open(imagenes[i], "rb").read())
        encode_base64(adjuntoImagen)
        anexoImagen = os.path.basename(imagenes[i])
        adjuntoImagen.add_header('Content-Disposition', 'attachment; filename= "%s"' % anexoImagen)
        adjuntoImagen.add_header('Content-ID','&lt;imagen_%s&gt;' % (i+1))
        msg.attach(adjuntoImagen)   
    #Files Attached ---------------
    if file:
       file = file.split('--')
       for i in range(len(file)):
        adjunto = MIMEBase('application', "octet-stream")
        adjunto.set_payload(open(file[i], "rb").read())
        encode_base64(adjunto)
        anexo = os.path.basename(file[i])
        adjunto.add_header('Content-Disposition', 'attachment; filename= "%s"' % anexo)
        msg.attach(adjunto)
    #Send ---------------------
    server = smtplib.SMTP('localhost')
    server.set_debuglevel(1)
    server.sendmail(fromaddr,[toaddr,tocc], msg.as_string())    #&lt;-- I modify this with the tocc
    server.quit()
    return
</code></pre>
