如何将Python电子邮件脚本配置为最新的AOL连接设置?

时间:2017-10-27 23:29:37

标签: python email smtp mail-server

我几乎对Python一无所知,我正在使用以下Python脚本向我的客户发送HTML电子邮件:

import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
addr_to   = 'example@domain.com'
addr_from = 'Me <me@domain.com>'
smtp_server = 'smtp.aol.com'
smtp_user   = 'username@aol.com'
smtp_pass   = 'password'
msg = MIMEMultipart('alternative')
msg['To'] = addr_to
msg['From'] = addr_from
msg['Subject'] = 'Email subject'
text = "Plain text goes here"
html = """\
HTML version goes here.
"""
part1 = MIMEText(text, 'plain')
part2 = MIMEText(html, 'html')
msg.attach(part1)
msg.attach(part2)
s = smtplib.SMTP(smtp_server)
s.login(smtp_user,smtp_pass)
s.sendmail(addr_from, addr_to, msg.as_string())
s.quit()

最近AOL给我发了一条消息,要求我将我的电子邮件应用程序更新为最新的安全连接设置,如下表所示:

AOL settings table

我想知道如何将表中给出的设置实现到我的Python代码中?谢谢!

1 个答案:

答案 0 :(得分:0)

我认为你可以改变

s = smtplib.SMTP(smtp_server)

s = smtplib.SMTP_SSL(smtp_server)