Zend certified PHP/Magento developer

raise SMTPServerDisconnected(“Connection unexpectedly closed”) [migrated]

new probelem with smtlib connection

exmple

all smtp in block / close / disconect when i try send email with python with gmail or private gmail domain

the code

import pandas as pd
import smtplib

e = pd.read_excel("xxx")
emails = e['xxx'].values
server = smtplib.SMTP("smtp.gmail.com", 587)
server.login = "xxx"
server.password = "xxx"
server.starttls()
msg = "Hello this is a email form python"
subject = "Hello world"
body = "Subject: {}nn{}".format(subject, msg)

for email in emails:
    server.sendmail(server.login, server.password, body)
server.quit()

error

  File "C:Python39libsmtplib.py", line 637, in auth
    (code, resp) = self.docmd("AUTH", mechanism + " " + response)
  File "C:Python39libsmtplib.py", line 427, in docmd
    return self.getreply()
  File "C:Python39libsmtplib.py", line 400, in getreply
    raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed

please your help .

enter image description here