expephalon/core/helpers/mail.py

12 lines
407 B
Python
Raw Normal View History

from core.modules.mail import providers
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=None, *args):
return get_provider_by_name(provider)().mail(*args)