close

[Solved] ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)

Hello Guys, How are you all? Hope You all Are Fine. Today I am just trying to send e-mail through my script but every time I am facing the following error ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056) in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056) Error Occurs ?

I am just trying to send e-mail through my script but every time I am facing the following error.

ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)

How To Solve ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056) Error ?

  1. How To Solve ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056) Error ?

    To Solve ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056) Error thing that worked was to use TLS over regular SMTP instead of SMTP_SSL And The port for SSL is 465 and not 587, however when I used SSL the mail arrived to the junk mail Just use this code to send email.

  2. ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)

    To Solve ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056) Error thing that worked was to use TLS over regular SMTP instead of SMTP_SSL And The port for SSL is 465 and not 587, however when I used SSL the mail arrived to the junk mail Just use this code to send email.

Solution 1: Use this code to send email.

Just use this code to send email.

import smtplib, ssl

port = 587  # For starttls
smtp_server = "smtp.gmail.com"
sender_email = "[email protected]"
receiver_email = "[email protected]"
password = "your smtp email password"
message = """This Message is send from python script"""

context = ssl.create_default_context()
with smtplib.SMTP(smtp_server, port) as server:
    server.ehlo()  # Can be omitted
    server.starttls(context=context)
    server.ehlo()  # Can be omitted
    server.login(sender_email, password)
    server.sendmail(sender_email, receiver_email, message)

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Please Rate Our Solution to Motivate Us For Give Our Best

Leave a Comment