我只是想知道这是否是发送电子邮件的正确方法?
一切看起来应该是普通的电子邮件程序吗?
import smtplib
login_Info = ["testemailforthis@gmail.com", "Password"]
receivers = ["testemailforthis@gmail.com"]
message = """From: Me
To: People
Subject: Test email
Hi this is a test email :D"""
try:
email_thing = smtplib.SMTP("smtp.gmail.com", 587)
email_thing.ehlo()
email_thing.starttls()
email.login(login_Info[0], login_Info[1])
email_thing.sendmail(login_Info[0], receivers, message)
email_thing.close()
print("The email was sent!")
except:
print("The email was unable to send!")