def call(self, when, cm, collect_point_results, backup_point_results):
self.set_extra_variables(cm, collect_point_results, backup_point_results)
msg = MIMEText(self.format_value(self.content))
# me == the sender's email address
# you == the recipient's email address
msg['Subject'] = self.format_value(self.subject)
msg['From'] = self.format_value(self.sender)
msg['To'] = self.format_value(self.recipient)
# Send the message via our own SMTP server.
if self.encryption == "tls":
smtp = smtplib.SMTP_SSL(host=self.hostname, port=self.port, keyfile=self.keyfile, certfile=self.certfile)
else:
smtp = smtplib.SMTP(host=self.hostname, port=self.port)
if self.encryption == 'starttls':
smtp.starttls(keyfile=self.keyfile, certfile=self.certfile)
if self.username and self.password:
smtp.login(self.username, self.password)
smtp.send_message(msg)
smtp.quit()
评论列表
文章目录