Forums

Email problems

I'm having problems with email. If I hit an error 500 the email sends out fine but if I use a function to send the email (like a password reset) it does not.

The structure of my app is based on this tutorial and so the structure is the same: https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-x-email-support

When I trigger an email in my dev environment, it works fine. Its only the hosted version thats a problem!

There are no errors in the log file, but I did find this from a while ago:

 2019-07-03 15:49:43,142: Exception in thread Thread-3:
2019-07-03 15:49:43,145: Traceback (most recent call last):
2019-07-03 15:49:43,145:   File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
2019-07-03 15:49:43,145:     self.run()
2019-07-03 15:49:43,146:   File "/usr/lib/python3.6/threading.py", line 864, in run
2019-07-03 15:49:43,146:     self._target(*self._args, **self._kwargs)
2019-07-03 15:49:43,146:   File "/home/brastile/BT_IN-Lookup/app/email.py", line 11, in send_async_email
2019-07-03 15:49:43,147:     mail.send(msg)
2019-07-03 15:49:43,147:   File "/home/brastile/.virtualenvs/BT_IN-Lookup/lib/python3.6/site-packages/flask_mail.py", line 491, in send
2019-07-03 15:49:43,147:     with self.connect() as connection:
2019-07-03 15:49:43,147:   File "/home/brastile/.virtualenvs/BT_IN-Lookup/lib/python3.6/site-packages/flask_mail.py", line 144, in __enter__
2019-07-03 15:49:43,148:     self.host = self.configure_host()
2019-07-03 15:49:43,148:   File "/home/brastile/.virtualenvs/BT_IN-Lookup/lib/python3.6/site-packages/flask_mail.py", line 163, in configure_host
2019-07-03 15:49:43,148:     host.starttls()
2019-07-03 15:49:43,148:   File "/usr/lib/python3.6/smtplib.py", line 771, in starttls
2019-07-03 15:49:43,148:     server_hostname=self._host)
2019-07-03 15:49:43,149:   File "/usr/lib/python3.6/ssl.py", line 407, in wrap_socket
2019-07-03 15:49:43,149:     _context=self, _session=session)
2019-07-03 15:49:43,149:   File "/usr/lib/python3.6/ssl.py", line 814, in __init__
2019-07-03 15:49:43,150:     self.do_handshake()
2019-07-03 15:49:43,150:   File "/usr/lib/python3.6/ssl.py", line 1068, in do_handshake
2019-07-03 15:50:30,186:     self._sslobj.do_handshake()
2019-07-03 15:50:30,499:   File "/usr/lib/python3.6/ssl.py", line 689, in do_handshake
2019-07-03 15:50:30,499:     self._sslobj.do_handshake()
2019-07-03 15:50:30,499: ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:841)

I had noticed that emails were taking a long time to send before it went dead now. Any thoughts?

Thanks!

Which site were you trying to access? It may be that that site is shutting down their SSL connections uncleanly?