Beispiel #1
0
def send_tour_reminder_email(tour):
    from_email = get_email_by_position('Tour Coordinator (Primary)', 'Tour Coordinator')
    to_person = tour.guide
    to_emails = ['{} <{}>'.format(to_person.full_name, to_person.email)]
    subject = 'Tour Tomorrow at {}'.format(tour.time_local().strftime('%-I:%M %p'))

    allow_texting = core_utils.get_setting('Allow Texting to Info Center')
    info_center_name = core_utils.get_setting('Info Center Director Name')
    info_center_phone = core_utils.get_setting('Info Center Phone Number')

    context = {'tour': tour, 'allow_texting': allow_texting, 'info_center_name': info_center_name, 'info_center_phone': info_center_phone}
    core_utils.send_email(subject, to_emails, from_email, 'email/tour_reminder.txt', 'email/tour_reminder.html', context)
Beispiel #2
0
def send_shift_reminder_email(shift):
    source_to_positions = {
        "TEACH": ('Tour Coordinator', 'Tour Coordinator (Primary)', 'Freshman Week Coordinator'),
        "Parents' Weekend": ('Freshman Week Coordinator',),
        "Visitas": ('Freshman Week Coordinator',),
        "Comp": ('Vice President',),
        "Arts First": ('Freshman Week Coordinator',),
        "Freshman Week": ('Freshman Week Coordinator',),
        "Other": ('Freshman Week Coordinator',),
    }

    from_email = get_email_by_position(*source_to_positions.get(shift.source))
    to_person = shift.person
    to_emails = ['{} <{}>'.format(to_person.full_name, to_person.email)]
    subject = 'Shift Tomorrow at {}'.format(shift.time_local().strftime('%-I:%M %p'))

    context = {'shift': shift}
    send_email(subject, to_emails, from_email, 'email/shift_reminder.txt', 'email/shift_reminder.html', context)
Beispiel #3
0
def text_response(request):
    from_email = to_email = get_email_by_position(
        'Secretary', 'Tour Coordinator (Primary)', 'Tour Coordinator')

    text = request.POST.get('Body')
    from_number = request.POST.get('From')

    if text is None or from_number is None:
        raise PermissionDenied

    try:
        person = Person.objects.get(phone=from_number)
        from_ = person.full_name
    except Person.DoesNotExist:
        from_ = from_number

    msg = EmailMultiAlternatives(u'Text Message to CKS Twilio Account',
                                 'Message from {}: {}'.format(from_, text),
                                 from_email, [to_email])
    msg.send()

    return render(request, 'core/response.xml', content_type="text/xml")