Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Connecting to the Mail Server With smtplib

Give Feedback

In this video, you’ll learn how to set up a basic connection to a SMTP server using Python’s smtplib and ssl modules. Additionally, a prospect of the following video is given.

Pygator on Aug. 25, 2019

how did you blur your password, when you input it for the script?

Joe Tatusko RP Team on Aug. 27, 2019

Hi Pygator! I’m actually doing that in my screen recording software. Python has libraries available if you want to have a traditional input field that doesn’t show the password, but I felt like they were outside the scope of this course. If you get a chance check out the getpass module!

Pygator on Aug. 31, 2019

Thanks for the module recommendation. Just finished the course.

vishukamble on Oct. 8, 2019

Pygator, You can use getpass module. From getpass import getpass password = getpass()

This will ask for password in the same way, it just won’t display the characters like in a linux terminal.

Aaron Horne on March 14, 2020

Not working for me.

Even installed secure-smtplib 0.1.1 even though some say smtplib is installed by default with python.

The error I get is:

Traceback (most recent call last):
  File "email.py", line 1, in <module>
    import smtplib, ssl
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/smtplib.py", line 47, in <module>
    import email.utils
  File "/Users/ahorne/Google Drive/scripts/email.py", line 13, in <module>
    with smtplib.SMTP_SSL(smtp_server, port, context=context) as server:
AttributeError: module 'smtplib' has no attribute 'SMTP_SSL'

gracetan on April 23, 2020

Hi Joe, i am wondering why do i have to put context=context after smtplib.SMTP_SSL? I tried to remove it, and the prorgam still worked. By reading the code requirment for the SMTP_SSL, it seems that context is optional.

Become a Member to join the conversation.