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
send_message as background task is not working #120
Comments
I have the same problem did anyone find a solution for this. |
how do you run the app? Uvicorn? Hypercorn? and which worker class are you use? can you switch between them? |
hey @ramiswailem, I'm using uvicorn: |
can you test it with: gunicorn main:app -k uvicorn.workers.UvicornWorker or with: pip install hypercorn[uvloop] |
Hi, this issue is solved in the new version of fastapi-mail, please install 1.0.9 version. |
I was on 1.0.6. |
Once I upgraded to 1.0.9 it was totally working, I was able to send with background task. Can you try, or could you tell me how you run it?
uvicorn app:app --port 8002 --reload |
The code I have is exactly what I wrote above (1st comment). locally I run it with |
Yes I have also the same issue since yesterday. I have tested the background task in main.py and it's not working but when I created a separate file for with similar endpoint with different name it's working. Somehow it's not working in my main.py |
Update |
Well, I dont know what you guys have a configuration in the application, but I checked maybe 5 with an HTML template, and without it (simple approach), it works finely. |
I am taking name as input from users and putting it into my html template. I have also updated the latest version. |
it does not matter, still, I dont see any error, please check each version of the libraries you are using. Try to use the debugger. |
I'm having the same issue on fastapi==0.78.0 and fastapi-mail==1.0.9.
Both debug=True/False option results same 'Success' but only |
Exact same issue.
|
some of the guy are using asyncio as mentioned here. Can you figure out the reason. I was going to use fastapi-mail in my project but now I am double mined. |
@sabuhish ,Is anybody working on this issue? |
Sorry for late response. I did not test with 1.0.9 but i solved my problem by using celery worker. So in background task i use Celery to send the mail using fastapi mail. |
I am also using celery worker now , in windows we need to use eventlet or solo as follows. it seems irrelevant but it may save time for others. |
Did anyone get this working with FastAPI for the background task only (no celery)? I have the most recent updated packages for uvicorn, fastapi & fastapi-mail. It used to work on previous versions but not anymore |
Hi There! I have tried many times, and still I don't have any issues with the same config as you have mentioned, I have been able to send emails with background tasks. Here is the configuration I have made and directories where my files lives. I have created app.py
The background is just executed in either thread or just calls the async function: https://github.com/encode/starlette/blob/master/starlette/background.py#L15 Apart from topics about background tasks that is not related to the fastapi-mail it is not part of the library, it is part of starlette, it is better to move the discussion there. |
Mails are not going out in background.
We have backgrounds tasks working well in other endpoints. Any idea of what could be the issue?
We tried without a template (exactly like your example) and it does not work either.
The text was updated successfully, but these errors were encountered: