[Python] smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server. Python

Discussão em 'Python' iniciado por Stack, Julho 25, 2025.

  1. Stack

    Stack Membro Participativo

    I am attempting to run a python script to automate sending emails but I keep running into this error.

    Any suggestions on how to fix this?

    import smtplib
    from email import message


    from_addr = 'myemail@gmail.com'
    to_addr = 'myemail@gmail.com'
    subject = 'Test Email'
    body = 'Test'
    msg = message.Message()
    msg.add_header('from', from_addr)
    msg.add_header('to', to_addr)
    msg.add_header('subject', subject)
    msg.set_payload(body)
    server = smtplib.SMTP('smtp.gmail.com', 587)
    server.login(from_addr, 'password')


    The error:

    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "C:\Program `Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\lib\smtplib.py", line 716, in login`
    raise SMTPNotSupportedError(

    smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server.

    Continue reading...

Compartilhe esta Página