通过python smtplib库添加右抄送和密送人

# filename任意,根据需要

att1["Content-Disposition"] = 'attachment; filename=%s.pdf' % (day)

message.attach(att1)

 

try:

smtpObj = smtplib.SMTP('xxx.com')

smtpObj.login('[email protected]', 'xxxpsd')

smtpObj.sendmail(sender, reciver, message.as_string())

log.warning("邮件发送成功")

except smtplib.SMTPException as e:

log.error(e)

log.error("Error: 无法发送邮件")

 

 

if __name__ == '__main__':

send_email(r'xxxx', 'xxx')

你可能感兴趣的:(python,log4j,nginx,中间件,websocket)