这是函数,错误是指向行msg = MIMEText(message)
的。我在这里得到mimetext的属性错误。有另一种写那行的方法吗?
def send_email(subject, message, from_addr=GMAIL_LOGIN, to_addr=GMAIL_LOGIN):
msg = MIMEText(message)
msg.add_header('Subject', subject)
msg.add_header('From', from_addr)
msg.add_header('To', to_addr)
msg.add_header('Reply-To', 'happyhours@noreply.com')
在引用它的下面
email = 'aashita9317@gmail.com'
send_email('Happy Hour Update',message,
from_addr=GMAIL_LOGIN, to_addr=email)