506629361 发表于 2017-4-26 09:33:17

Python email 开发

def send_email(self):
self.emails='a1@b.c,a2@b.c'
msg = MIMEText(self.content)
msg['SUBJECT'] = self.subject
msg['TO'] = ', '.join(self.emails)
print(msg['TO'])
msg['FROM'] = self.sender
HOST = self.mailserver
self.write('sending email to '+msg['TO'])
server = smtplib.SMTP(HOST)
server.sendmail(msg['FROM'],self.emails,msg.as_string())
server.quit()
页: [1]
查看完整版本: Python email 开发