smtplib: Why do the recipients in "To" field receive the mail twice?
<p>I searched about this quite a lot, but could not fix the issue in my script. So finally, I decided to post it here.</p>

<p>Here's the code snippet:</p>

<pre><code>fromaddr = "someValidAddress@xyz.com"
cc = ['SomeEmailAlias@xyz.com']
toaddr = ""
    msg = MIMEMultipart()
    toaddrlist = list(toaddr.split(',')) #As sendmail() accepts the list of recipients only in list form.
    toaddrlist += (cc,)
    msg['From'] = fromaddr
    msg['To'] = toaddr
    msg['Cc'] = ', '.join(cc)
    msg['Date'] = formatdate(localtime=True)
    msgHtml = MIMEText(html, 'html')
    msg.attach(msgHtml)
    msg['Subject'] = "Test mail"
    server = "someMailServer.xyz.com"
    smtp = smtplib.SMTP(server, 25)
    smtp.sendmail(fromaddr, toaddrlist, msg.as_string())
    smtp.close() #Close the SMTP server connection.
</code></pre>

<p>I'm aware and I've ensured that msg['To'] accepts a string value (toaddr), whereas toaddrlist in sendmail() should be a list.</p>

<p>Catch: If I remove the line <code>toaddrlist += (cc,)</code>, then the mail does not get delivered twice to the recipients in "To" field, but the mail does not get delivered to the Cc alias.</p>

<p>Please help.</p>