May-12-2018, 10:00 AM
Hi Team,
Start tls ()is throwing below error
A
Start tls ()is throwing below error
Error:send: 'STARTTLS\r\n'
reply: '220 2.0.0 SMTP server ready\r\n'
reply: retcode (220); Msg: 2.0.0 SMTP server ready
Unexpected error: <class 'ssl.SSLEOFError'>
Traceback (most recent call last):
File "./kad.py", line 24, in <module>
server.starttls()
File "/usr/lib64/python2.7/smtplib.py", line 648, in starttls
self.sock = ssl.wrap_socket(self.sock, keyfile, certfile)
File "/usr/lib64/python2.7/ssl.py", line 936, in wrap_socket
ciphers=ciphers)
File "/usr/lib64/python2.7/ssl.py", line 611, in __init__
self.do_handshake()
File "/usr/lib64/python2.7/ssl.py", line 833, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:579)
import sys import smtplib import email.utils from email.mime.text import MIMEText # Create the message msg = 'This is the body of the message.' FROMADDR = "[email protected]" TOADDRS = "[email protected]" server = smtplib.SMTP(host='<smtp server>',port=25) server.set_debuglevel(True) # show communication with the server print msg try: server.starttls() server.ehlo() server.sendmail(FROMADDR,TOADDRS,msg) except: print "Unexpected error:", sys.exc_info()[0] raiseThanks
A