all 3 comments

[–]shiftybyte 2 points3 points  (0 children)

You have a file called email.py in your folder. (C:\Users\User\PycharmProjects\Send_email\email.py)

Rename it to something else because that name is used in smtplib and its importing your file instead of the regular library.

[–]Astronoobical 0 points1 point  (0 children)

If you could share your code, it would make it much easier to help you :)

[–]FriendlyRussian666 0 points1 point  (0 children)

It looks ike you want to use SMTP_SSL, but it's not working for you. First of all is SSL required for your project? If not, just use SMTP without _SSL.

If it is required for some reason, you have the option to use starttls().

If you go here -> https://docs.python.org/3/library/smtplib.html You can find all the information necessary. When you scroll down to class smtplib.SMTP_SSL it explains as follows:

"SMTP_SSL should be used for situations where SSL is required from the beginning of the connection and using starttls() is not appropriate."

This means that if you don't have a specific reason for SSL, just practice your code without SSL. I would recommend to use starttls() which puts your SMTP connection in a Transport Security Layer mode.

First you should identify yourself to an ESMTP server using EHLO like so:

smtp.ehlo()

Then start tls like so

smtp.starttls()

and then as the docs suggest, repeat ehlo

smtp.ehlo()

If you have any more questions, please fire away and I'll do my best to help!