pgyzhu
pgyzhu

Reputation: 51

Python smtplib has no attribute SMTP_SSL

I'm try to send an email with SMTP_SSL (the mail server does not support smtp).

import smtp
s = smtp.SMTP_SSL('xxxxx')

I get an error:

module object has no attribute 'SMTP_SSL'

I don't quite understand why python smptlib has no attribute SMTP_SSL given that the python documentation shows that SMTP_SSL has this attribute.

Upvotes: 5

Views: 1914

Answers (2)

tenuki
tenuki

Reputation: 182

When python is compiled without ssl support, you get an smtp module without the expected attribute: SMTP_SSL.

This happens sometimes when openssl is not automatically detected, maybe some dependency isn't installed on the system when python was built.

Here is a tutorial on how to overcome that: https://techglimpse.com/install-python-openssl-support-tutorial/

Upvotes: 1

jomisore
jomisore

Reputation: 61

Either your script's name is email.py or you have another script in your directory named email.py. You should change the name of the script.

Upvotes: 5

Related Questions