任何人都可以指导我为多封电子邮件通知测试结果编写脚本。
import smtplib
from email.mime.text import MIMEText
class EmailClient():
def __init__(self, my_address):
self.my_address = my_address
def send(self, message, subject, user, email):
header = "Hello " + str(user) + ",\n\n"
footer = "\n\n-Your Boss"
msg = MIMEText(header + message + footer)
msg['Subject'] = subject
msg['From'] = self.my_address
msg['To'] = email
s = smtplib.SMTP('localhost')
s.sendmail(self.my_address, [email], msg.as_string())
s.quit()
EClient = EmailClient("MyEmail@University.edu")
EClient.send("This is a test Email", "Test Subject", "John Doe", "jdoe@University.edu")
发送没有附件的邮件$ {SMTP_SERVER} $ {USER} $ {PASS} $ {mail},$ {mail2} $ {subject} $ {text},此操作无效。
我真的需要通过许多电子邮件发送它,我的脚本仅适用于单个电子邮件。