mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-11 08:43:10 +00:00
Add generic send_email task in wagtailadmin.tasks
This will be used from the send form data to email. It has been added to the wagtailadmin.tasks module to use celery if it has been defined and configured or just send the email if not (just like the send_notification task).
This commit is contained in:
parent
92563ff535
commit
b6aca526da
1 changed files with 13 additions and 0 deletions
|
|
@ -85,3 +85,16 @@ def send_notification(page_revision_id, notification, excluded_user_id):
|
|||
|
||||
# Send email
|
||||
send_mail(email_subject, email_content, from_email, email_addresses)
|
||||
|
||||
|
||||
@task
|
||||
def send_email_task(email_subject, email_content, from_email, email_addresses):
|
||||
if not from_email:
|
||||
if hasattr(settings, 'WAGTAILADMIN_NOTIFICATION_FROM_EMAIL'):
|
||||
from_email = settings.WAGTAILADMIN_NOTIFICATION_FROM_EMAIL
|
||||
elif hasattr(settings, 'DEFAULT_FROM_EMAIL'):
|
||||
from_email = settings.DEFAULT_FROM_EMAIL
|
||||
else:
|
||||
from_email = 'webmaster@localhost'
|
||||
|
||||
send_mail(email_subject, email_content, from_email, email_addresses)
|
||||
|
|
|
|||
Loading…
Reference in a new issue