Networking and Internet Modules

smtplib

SMTP client for submitting email to mail servers; message construction belongs to email. SMTP_SSL and STARTTLS offer different TLS setup paths. Use a verifying SSL context, authenticated submission where required and explicit recipient handling. Creating a client without a host does not send mail.

Formal Syntax & Structure

python syntaxpython
import smtplib

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
from smtplib import SMTPclient = SMTP(timeout=3)print(client.sock is None)
Python Reference