2013-06-29 46 views
-1

如何在下面格式化CC列表?python and email.utils - 如何添加CC列表

我應該加'CC:[email protected]; [email protected]'嗎?

CC = ['[email protected]','[email protected]'] 



    header = 'To:' + TO_ADDRESS + '\n' + 'From: ' + FROM_ADDRESS + '\n' + 'Subject:' + SUB_ADD + '\n' 
    msg = header + '\n' + TEXT_INSERT'server = smtplib.SMTP('smtp.gmail.com', 587) 
    server.ehlo() 
    server.starttls() 
    server.ehlo() 
    server.login(FROM_ADDRESS, PASSWORD) 
    server.sendmail(FROM_ADDRESS, TO_ADDRESS, msg) 
    server.close() 

回答

1

您需要的CC地址添加到兩個頭(header信封(SMTP.sendmail(..., to_addrs, ...))。