Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email issue #100

Open
hubortje opened this issue Sep 21, 2024 · 2 comments
Open

Email issue #100

hubortje opened this issue Sep 21, 2024 · 2 comments

Comments

@hubortje
Copy link

hubortje commented Sep 21, 2024

Hey, when trying to send a verification email, the container throws the following error

web | WARNING 2024-09-21 18:54:26,780 confirm WARNING: the URL seems to be malformed - http://localhost/email/email/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImV4YW1wbGVAZXhhbXBsZS5jb20iLCJleHAiOjE3MjY5NDEyNjYuNzc4MDk1LCJraW5kIjoiTUFJTCJ9.29z292u5b79_ffGEpoU0NBB6dvhkMC-nybw1YJRIk7Q

web  | Exception in thread Thread-2 (send_inner_thread):
web  | Traceback (most recent call last):
web  |   File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
web  |     self.run()
web  |   File "/usr/lib/python3.10/threading.py", line 953, in run
web  |     self._target(*self._args, **self._kwargs)
web  |   File "/usr/local/lib/python3.10/dist-packages/django_email_verification/confirm.py", line 97, in send_inner_thread
web  |     msg.send()
web  |   File "/usr/local/lib/python3.10/dist-packages/django/core/mail/message.py", line 299, in send
web  |     return self.get_connection(fail_silently).send_messages([self])
web  |   File "/usr/local/lib/python3.10/dist-packages/django/core/mail/backends/smtp.py", line 127, in send_messages
web  |     new_conn_created = self.open()
web  |   File "/usr/local/lib/python3.10/dist-packages/django/core/mail/backends/smtp.py", line 85, in open
web  |     self.connection = self.connection_class(
web  |   File "/usr/lib/python3.10/smtplib.py", line 255, in __init__
web  |     (code, msg) = self.connect(host, port)
web  |   File "/usr/lib/python3.10/smtplib.py", line 343, in connect
web  |     (code, msg) = self.getreply()
web  |   File "/usr/lib/python3.10/smtplib.py", line 405, in getreply
web  |     raise SMTPServerDisconnected("Connection unexpectedly closed")
web  | smtplib.SMTPServerDisconnected: Connection unexpectedly closed
web  | Exception in thread Thread-3 (send_inner_thread):
web  | Traceback (most recent call last):
web  |   File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
web  |     self.run()
web  |   File "/usr/lib/python3.10/threading.py", line 953, in run
web  |     self._target(*self._args, **self._kwargs)
web  |   File "/usr/local/lib/python3.10/dist-packages/django_email_verification/confirm.py", line 97, in send_inner_thread
web  |     msg.send()
web  |   File "/usr/local/lib/python3.10/dist-packages/django/core/mail/message.py", line 299, in send
web  |     return self.get_connection(fail_silently).send_messages([self])
web  |   File "/usr/local/lib/python3.10/dist-packages/django/core/mail/backends/smtp.py", line 127, in send_messages
web-  |     new_conn_created = self.open()
web  |   File "/usr/local/lib/python3.10/dist-packages/django/core/mail/backends/smtp.py", line 85, in open
web  |     self.connection = self.connection_class(
web  |   File "/usr/lib/python3.10/smtplib.py", line 255, in __init__
web  |     (code, msg) = self.connect(host, port)
web  |   File "/usr/lib/python3.10/smtplib.py", line 343, in connect
web  |     (code, msg) = self.getreply()
web  |   File "/usr/lib/python3.10/smtplib.py", line 405, in getreply
web  |     raise SMTPServerDisconnected("Connection unexpectedly closed")
web  | smtplib.SMTPServerDisconnected: Connection unexpectedly closed

I've changed the JSON web token to display the domain "[email protected]" and fudged with the exp-value. If you need these to debug, tell me please.

From my wger.env-file:

ENABLE_EMAIL=True
EMAIL_HOST=smtp.strato.de
EMAIL_PORT=465
[email protected]
EMAIL_HOST_PASSWORD='pa#ss'word*'
EMAIL_USE_TLS=True
EMAIL_USE_SSL=False
FROM_EMAIL='wger Workout Manager'
@bbkz
Copy link

bbkz commented Sep 22, 2024

Try with

FROM_EMAIL='[email protected]'

This must be a mail address the mailserver is accepting to send from, with the given user EMAIL_HOST_USER.

But i found the following bug report: #35

@CYPH4R
Copy link

CYPH4R commented Sep 23, 2024

I've had the same issue and i fixed it by setting DEBUG=False in the prod.env file. Somewhere else it said that the DEBUG variable sets the Django server into Dev mode and certain things break.

Also you seem to have forgotten to set the SITE_URL variable to the actual domain where you are running your server on. If you don set that the confirmation email has a link that starts with https://localhost and that doesn't point to your wger instance (unless you run it on your local machine)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants