SMTP.login()
SMTP.login() is a Python method in the Smtplib Module category. Authenticates to the SMTP server using a username and password. The syntax is SMTP.login(user, password, *, initial_response_ok=True). Returns: Server response tuple. A typical example: server.login("user@gmail.com", "app_password"). A close sibling is smtplib.SMTP(), which creates an SMTP client for sending emails. A close sibling is SMTP.sendmail(), which sends an email message from one address to one or more recipients. A close sibling is SMTP.starttls(), which puts the SMTP connection in TLS mode for encrypted communication. A close sibling is SMTP.quit(), which closes the SMTP connection gracefully. More about this category: SMTP email sending — SMTP, sendmail, login, quit. Related Smtplib Module entries: smtplib.SMTP(), SMTP.sendmail(), SMTP.starttls(), SMTP.quit(), SMTP.ehlo(), smtplib.SMTP_SSL(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details. You can try SMTP.login() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.