anoved / OctoPrint-EmailNotifier

Receive email notifications when OctoPrint jobs are complete. Currently broken. Please fork and fix!
GNU Affero General Public License v3.0
16 stars 35 forks source link

STARTTLS Issues #55

Open thebeline opened 3 years ago

thebeline commented 3 years ago

I am receiving a STARTTLS WRONG_VERSION_NUMBER error. My email server is used by a number of people, and many different application clients, without issue. I believe the problem here is related to Python 3.5, and this StackOverflow issue.

I don't know, however, as I have dug through the YagMail repo and found no mention of this issue (and I feel like it would show up). Any help would be fantastic.

Configured with my email domain, port 587 Use TLS/Use SSL, the correct username and password, and Thunderbird connects to the account just fine...

thebeline commented 3 years ago

Full Error from the log:

2021-03-02 15:22:19,436 - octoprint.plugins.emailnotifier - ERROR - Email notification error: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_emailnotifier/__init__.py", line 152, in on_api_command
    self.send_notification(subject, body, snapshot, event="test")
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_emailnotifier/__init__.py", line 193, in send_notification
    mailer.send(to=emails, subject=subject, contents=body, headers={"Date": formatdate()})
  File "/home/pi/oprint/lib/python3.7/site-packages/yagmail/sender.py", line 153, in send
    self.login()
  File "/home/pi/oprint/lib/python3.7/site-packages/yagmail/sender.py", line 206, in login
    self._login(self.credentials)
  File "/home/pi/oprint/lib/python3.7/site-packages/yagmail/sender.py", line 213, in _login
    self.smtp = self.connection(self.host, self.port, **self.kwargs)
  File "/usr/lib/python3.7/smtplib.py", line 1031, in __init__
    source_address)
  File "/usr/lib/python3.7/smtplib.py", line 251, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python3.7/smtplib.py", line 336, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python3.7/smtplib.py", line 1039, in _get_socket
    server_hostname=self._host)
  File "/usr/lib/python3.7/ssl.py", line 412, in wrap_socket
    session=session
  File "/usr/lib/python3.7/ssl.py", line 853, in _create
    self.do_handshake()
  File "/usr/lib/python3.7/ssl.py", line 1117, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)