17 lines
422 B
Python
17 lines
422 B
Python
import smtplib
|
|
from email.mime.text import MIMEText
|
|
|
|
smtp_server = "smtp.gmail.com"
|
|
smtp_port = 587
|
|
sender = "liuming256kb@gmail.com"
|
|
app_pwd = "xkbt oorr zylb lnjt"
|
|
|
|
msg = MIMEText("测试邮件内容")
|
|
msg["Subject"] = "SMTP测试"
|
|
msg["From"] = sender
|
|
msg["To"] = "6293968@qq.com"
|
|
|
|
with smtplib.SMTP(smtp_server, smtp_port) as server:
|
|
server.starttls()
|
|
server.login(sender, app_pwd)
|
|
server.send_message(msg) |