expephalon-chat/core/helpers/mail.py
Klaus-Uwe Mitterer d549897186 Too many things to remember all of them
Finally got the mail queue working
Oh yeah, queueing
Added a TOTP provider which doesn't do anything much yet
Probably a hell of a lot of other things that I just can't remember
2020-05-13 12:38:37 +02:00

20 lines
No EOL
802 B
Python

from core.modules.mail import providers
from core.tasks.mail import send_mail as send_mail_task
from dbsettings.functions import getValue
def get_provider_by_name(name, fallback=True):
return providers.get(name, None) or providers["smtp"]
def get_default_provider(fallback=True):
return get_provider_by_name(getValue("core.email.provider", "smtp"), fallback)
def send_mail(provider=get_default_provider(), **kwargs):
provider = get_provider_by_name(provider) if type(provider) == str else provider
return send_mail_task.delay(provider, **kwargs)
def simple_send_mail(subject, content, recipients, cc=[], bcc=[], headers={}):
return send_mail(subject=subject, content=content, recipients=recipients, cc=cc, bcc=bcc, headers=headers)
def fetch_templates(template_name):
pass