Python · Sending Email

Name the standard-library module for each role: send an email, retrieve mail leaving copies on the server, and download mail off the server.

Answer locked. Get the free KnowCard app to reveal it — plus spaced-repetition review so it actually sticks.

Get it on App StoreGet it on Google Play

This is one card from the KnowCard library — thousands more across SAP, Linux, Python and more. In the app you get the answer, AI explanations, and cards that come back right before you would forget them. Free to start on iOS, Android or the web.

More in Sending Email

You want your Python script to SEND an outgoing email. Which standard-library module connects to the mail server, and which protocol does it speak?
You connect with smtplib.SMTP(host, 587), then immediately call .login(...) over the plain connection. Why is this a problem, and what step is missing?
For an encrypted SMTP connection, what's the difference between smtplib.SMTP with .starttls() and smtplib.SMTP_SSL — including the typical port for each?
What does smtp.sendmail(...) return when ALL recipients accepted the message, and how would a competent dev wrongly interpret it?
In smtp.sendmail(from_addr, to_addrs, msg), you pass a single recipient string "a@b.com" as to_addrs and it works. Then you switch to two recipients — what's the gotcha?
What happens when you run this? ``` from email.message import EmailMessage m = EmailMessage() m["Subject"] = "Hi" m["Subject"] = "Bye" print(m["Subject"]) ```

Start learning today

Free to start — download the app or use it in your browser.

Get it on App StoreGet it on Google Play