Conversation
docs/customizing.rst
Outdated
|
||
return app | ||
|
||
Note that the above ``security.send_mail_task`` override will be useless if you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you consider using .. note::
directive http://www.sphinx-doc.org/en/stable/markup/para.html#directive-note ?
docs/customizing.rst
Outdated
app.config.from_object(config) | ||
|
||
def custom_send_mail(subject, recipient, template, **context): | ||
# implement your own logic here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add an example when it would be necessary to override the send_mail
method?
@jirikuncar I added an example. I hope it does not feel too contrived. My real world use case is too complex to be suitable for an example. |
docs/customizing.rst
Outdated
|
||
from flask import Flask | ||
from flask_security import Security, SQLAlchemyUserDatastore | ||
from flask.ext.emails import Message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from flask_emails ...
Thought I'd mention that I personally have been using this branch of It seems to me that |
* Make send_mail function customizable.
* Customizable send_mail (#730) * Make send_mail function customizable. * Modified original commit to set send_mail and render_template as init configurations. This is easier than subclassing Security and is the same as other overrides such as login_manager. Updated docs.
Hi,
This pretty straightforward PR lets you override the
send_mail
method with your own logic. The override method is similar torender_template
.Thanks for considering this!