message = Message() message["Subject"] = subject message["From"] = fake_sender message["To"] = ";".join(fake_recipients) #Copy to #message["CC"] is only for display, to send the email we must specify it in the method "SMTP.sendmail". #message["CC"] = "real_recipients1@abc.cn,real_recipients2@abc.cn" message.set_payload(content) message.set_charset("utf-8") msg = message.as_string()
sm = smtplib.SMTP(server) sm.set_debuglevel(0) #sm.set_debuglevel(1) sm.ehlo() sm.starttls() sm.ehlo() sm.login(real_sender, passwd)