def _send_mail_to_user(user, subject, templateName, contextData, whentrue):
    if (user.getUserInfo()
            and (not whentrue or getattr(user.getUserInfo(), whentrue))):
        template = get_template(templateName)
        context = Context(contextData)
        html_content = template.render(context)
        send_html_mail(subject, html_content, html_content,
                       settings.DEFAULT_FROM_EMAIL, [user.email])
def plain_send_mail(to, subject, body, from_email=settings.DEFAULT_FROM_EMAIL):
    send_html_mail(subject, body, body, from_email, [to])
def notify_admin(subject, msg):
    send_html_mail(subject, msg, msg, settings.DEFAULT_FROM_EMAIL, ADMINS_EMAILS)
def _send_mail_to_user(user, subject, templateName, contextData, whentrue):
    if(user.getUserInfo() and (not whentrue or getattr(user.getUserInfo(), whentrue))):
        template = get_template(templateName)
        context = Context(contextData)
        html_content = template.render(context)
        send_html_mail(subject, html_content, html_content, settings.DEFAULT_FROM_EMAIL, [user.email])
def notify_admin(subject, msg):
    send_html_mail(subject, msg, msg, settings.DEFAULT_FROM_EMAIL,
                   ADMINS_EMAILS)
def plain_send_mail(to, subject, body, from_email=settings.DEFAULT_FROM_EMAIL):
    send_html_mail(subject, body, body, from_email, [to])
def plain_send_mail(to, subject, body):
    send_html_mail(subject, body, body, settings.DEFAULT_FROM_EMAIL, [to])
def _send_mail_to_user(user, subject, templateName, contextData):
    if(user.getUserInfo() and user.getUserInfo().receiveAllEmail):
        template = get_template(templateName)
        context = Context(contextData)
        html_content = template.render(context)
        send_html_mail(subject, html_content, html_content, settings.DEFAULT_FROM_EMAIL, [user.email])