-
-
Notifications
You must be signed in to change notification settings - Fork 514
Asynchronous mail sending #325
Comments
I was able to do this myself, as follows: decorator.py:
and in app.py:
Hope this helps someone looking to do the same. |
Excellent. Thanks! I actually took a stab at incorporating this yesterday but ran out of time and was having circular import issues. The way you've applied seems to address that. Where did you find @security.send_mail_task declared btw? |
I found it referenced here: https://pythonhosted.org/Flask-Security/customizing.html#emails-with-celery and decided to try the pattern mentioned in Miguel Grinberg's blog: http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xi-email-support |
Any tips on getting this set up with an application factory function? I'm running into issues with circular imports. Not sure exactly where to drop the decorators. Thanks in advance. |
not sure about application factory functions, but I put it in the decorator.py file like shown above. that file doesn't import anything but Thread, which is probably why I didn't get circular imports. I created it for this purpose, though now it has some other odds and ends in it. it's just one more file, and worked great for me. |
It might be nice to be able to configure the default mails that are sent out for email authentication to be able to be sent asynchronously, so the thread is not blocked when signups occur.
The text was updated successfully, but these errors were encountered: