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

Cannot send mail (unraid) #432

Closed
maximushugus opened this issue Sep 30, 2023 · 10 comments
Closed

Cannot send mail (unraid) #432

maximushugus opened this issue Sep 30, 2023 · 10 comments
Labels
api bug v0.7.x Issues planned in versions 0.7.x

Comments

@maximushugus
Copy link

First I would like to thank the developpers for this awesome project.

I set up FitTrackee on docker on Unraid.
To do this on Unraid :

  1. I set up a Postgresql container, and created a database for FitTrackee
  2. I set up this container on docker with all the variables needed : https://hub.docker.com/r/nowsci/fittrackee
  3. Open a shell inside the container and run "ftcli db drop" and "ftcli db upgrade"
  4. Create a user with the web UI
  5. Open a shell inside the container and run "ftcli users update REPLACEWITHUSERNAME --set-admin true"

Everything seem to work.

But I'm not able to set up mail :
My mail server runs with startls so I set the variable EMAIL_URL this way : "smtp://username:[email protected]:587/?tls=True"
For my mail server, the user is [email protected], and my mail account contains "?, @ and &" caracter
So if I this the variable for EMAIL_URL is "smtp://[email protected]:passwith@and&[email protected]:587?tls=True" I get an error and the container cannot run because I think the first @ is not escaped.

So I tried "smtp://mail%40server.com:passwith%3Fand%40and%[email protected]:587?tls=True".
With this variable, the container can run without any error.
But if I try to send a mail (for exemple to confirm a user) : nothing happens, the mail is not send and this is no error on logs...

If someone have an idea ?

Thanks

@astridx
Copy link
Contributor

astridx commented Sep 30, 2023

Did you configurate Redis?
See

# Redis (required for API rate limits and email sending)

@maximushugus
Copy link
Author

Yes, I forgot to specify this in my first post, I already had a redis docker, and configured my Fittrackee container with the variable for redis.

@SamR1
Copy link
Owner

SamR1 commented Oct 2, 2023

Hi,

On startup, FitTrackee loads the email config from EMAIL_URL. If it cannot parse the environment variable, it raises an error.
If there is no error at startup, it only means that EMAIL_URL can be parsed (credentials may be invalid).

If no email is sent and there are no errors in the logs, it seems that the dramatiq workers have not been started.
Can you check if the workers are running?
(just for information, I'm not the maintainer of the docker image)

Encoded passwords are not decoded by FitTrackee, I'll fix that. Thanks for the bug report.

@SamR1 SamR1 added bug api v0.7.x Issues planned in versions 0.7.x labels Oct 2, 2023
@SamR1 SamR1 added this to the v0.7 - OAuth 2.0 milestone Oct 2, 2023
@maximushugus
Copy link
Author

By running a shell inside the container, I executed this command :
"flask worker --processes=2 >> dramatiq.log 2>&1"
But nothing happens.
Inside the "dramatiq.log" I have this error :

2023/10/02 15:09:01 - dramatiq.worker.WorkerThread - ERROR - Failed to process message account_confirmation_email({'language': 'fr', 'email': '[email protected]'}, {'username': 'divers', 'fittrackee_url': 'https://fittrackee.server.fr', 'operating_system': 'Windows', 'browser_name': 'Firefox', 'account_confirmation_url': 'https://fittrackee.server.fr/account-confirmation?token=q8PCPWxZSj4iGnudb504fV28WXkB_9GHg9hP4mua'}) with unhandled exception.
Traceback (most recent call last):
File "/opt/venv/lib/python3.10/site-packages/dramatiq/worker.py", line 485, in process_message
res = actor(*message.args, **message.kwargs)
File "/opt/venv/lib/python3.10/site-packages/dramatiq/actor.py", line 177, in call
return self.fn(*args, **kwargs)
File "/usr/src/app/fittrackee/emails/tasks.py", line 48, in account_confirmation_email
email_service.send(
File "/usr/src/app/fittrackee/emails/email.py", line 173, in send
smtp.login(self.username, self.password) # type: ignore
File "/usr/local/lib/python3.10/smtplib.py", line 750, in login
raise last_exception
File "/usr/local/lib/python3.10/smtplib.py", line 739, in login
(code, resp) = self.auth(
File "/usr/local/lib/python3.10/smtplib.py", line 662, in auth
raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (535, b'5.7.8 Error: authentication failed:')

@SamR1
Copy link
Owner

SamR1 commented Oct 2, 2023

thanks for the feedback.

encoded password is not decoded, the MR #433 will fix this bug (fix not yet released).

@maximushugus
Copy link
Author

Thanks
With this fix, are we supposed to put the EMAIL_URL with quotation marks or use encoded caracters as here ?

@SamR1
Copy link
Owner

SamR1 commented Oct 2, 2023

With encoded characters.
For instance with password passwith@and&and?, the EMAIL_URL will be: smtp://[email protected]:passwith%40and%26and%[email protected]:587?tls=True

@maximushugus
Copy link
Author

Ok
The "@" character in the username doesn't need to be encoded ?

@SamR1
Copy link
Owner

SamR1 commented Oct 2, 2023

Yes, no need to encode the @ in username.

@SamR1
Copy link
Owner

SamR1 commented Oct 4, 2023

fix on encoded password released in v0.7.24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api bug v0.7.x Issues planned in versions 0.7.x
Projects
None yet
Development

No branches or pull requests

3 participants