SMTP AUTH extension not supported by server in python 2.4

前端 未结 2 518
無奈伤痛
無奈伤痛 2021-02-05 15:42

This is my normal code in my VPS hosting which provide python 2.4

def mail(receiver,Message):
    import smtplib
    try:
        s=smtplib.SMTP()
        s.con         


        
2条回答
  •  遥遥无期
    2021-02-05 16:13

    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
    

提交回复
热议问题