Esempio n. 1
0
def mail_lot_watchers(lot, subject, message, excluded_emails=[], is_note=False, url_suffix=""):
    """
    Sends a message to watchers of a given lot or group of lots.
    """
    watchers = Watcher.objects.filter(lot__in=lot.lots, email__isnull=False)
    watchers = [w for w in watchers if w.email not in excluded_emails]
    messages = _get_messages(watchers, message, "organize/notifications/watchers_text.txt", url_suffix, is_note=is_note)
    mail_multiple_personalized(subject, messages, **get_message_options(lot, is_note=is_note))
Esempio n. 2
0
def mass_mailing(subject, message, objects, template_name, **kwargs):
    messages = {}
    for obj in objects:
        # message gets sent once to each unique email address, thanks to dict
        messages[obj.email] = render_to_string(
            template_name, {"BASE_URL": settings.BASE_URL, "lot": obj.lot, "message": message, "obj": obj}
        )

    mail_multiple_personalized(subject, messages, from_email=settings.ORGANIZERS_EMAIL, **kwargs)
Esempio n. 3
0
def mass_mailing(subject, message, objects, template_name, **kwargs):
    messages = {}
    for obj in objects:
        # message gets sent once to each unique email address, thanks to dict
        messages[obj.email] = render_to_string(
            template_name, {
                'BASE_URL': settings.BASE_URL,
                'lot': obj.lot,
                'message': message,
                'obj': obj,
            })

    mail_multiple_personalized(subject,
                               messages,
                               from_email=settings.ORGANIZERS_EMAIL,
                               **kwargs)
Esempio n. 4
0
def mail_lot_watchers(lot,
                      subject,
                      message,
                      excluded_emails=[],
                      is_note=False,
                      url_suffix=''):
    """
    Sends a message to watchers of a given lot or group of lots.
    """
    watchers = Watcher.objects.filter(lot__in=lot.lots, email__isnull=False)
    watchers = [w for w in watchers if w.email not in excluded_emails]
    messages = _get_messages(
        watchers,
        message,
        'organize/notifications/watchers_text.txt',
        url_suffix,
        is_note=is_note,
    )
    mail_multiple_personalized(subject, messages,
                               **get_message_options(lot, is_note=is_note))