Platform
Docs
Solutions
ContactLog In

Error: Name "smtplib" is not defined

What's Causing This Error?

This error occurs in Python when you do not import the smtplib library in your email sending script.

Solution - Here's How To Resolve It

Import the smtplib module into your Python script to resolve this error, as shown below.

1 2 3 4 5 6 import smtplib # import smtp library in your Python script to fix the error. # Replace with your email sending code # Sample: Testing a connection to Google SMTP server session = smtplib.SMTP('smtp.gmail.com',587) print(session)

Other Common SMTPLIB Errors (and Solutions)

View all errors

Build your first notification in minutes

Send up to 10,000 notifications every month, for free.

Get started for free

Email & push notification

Build your first notification in minutes

Send up to 10,000 notifications every month, for free.

Get started for free

Email & push notification

Platform

Users

Content

Channels

Sending

Workflows

Preferences

Inbox

Workspaces

Observability

API Status

Changelog

© 2024 Courier. All rights reserved.