SMTP AUTH extension not supported by server in python 2.4

微笑、不失礼 提交于 2019-12-03 02:20:44
Hamoudaq

Guys thanks i've found the solution and this is the solution =)

def mail(receiver,Message):
    import smtplib
    try:
        s=smtplib.SMTP()
        s.connect("smtp.gmail.com",465)
        s.ehlo()
        s.starttls()
        s.ehlo()
        s.login("email@gmail.com", "password")
        s.sendmail("email@gmail.com", receiver, Message)
    except Exception,R:
            return R

Is SMTP.starttls() available? You can also do e.g.:

def mail(receiver,Message):
    import smtplib
    try:
        s=smtplib.SMTP()
        s.connect("smtp.gmail.com",587)
        s.starttls()
        s.login("email@gmail.com", "password")
        s.sendmail("email@gmail.com", receiver, Message)
    except Exception,R:
            return R
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!