Пример #1
0
def send_email_conf(confirmation):
    context = {
        'confirmation_id': confirmation.id,
    }
    template = 'email/email_confirmation.md'
    send_messages_async(
        [prepare_email(confirmation.as_email_recipient(), template, context)])
Пример #2
0
 def test_send_many_messages_async(self):
     self.assertEqual(len(mail.outbox), 0)
     send_messages_async([
         mail.EmailMessage('Subject', 'Body', '*****@*****.**',
                           ['*****@*****.**'])
     ] * 5)
     self.assertEqual(len(mail.outbox), 5)
Пример #3
0
def send_invite(invite):
    context = {
        'new': (Member.objects.filter(email=invite.email).count() == 0),
        'invite_id': invite.id,
        'band_name': invite.band.name if invite.band else None
    }
    template = 'email/invite.md' if invite.band else 'email/signup.md'
    send_messages_async([prepare_email(invite.as_email_recipient(), template, context)])
Пример #4
0
 def form_valid(self, form):
     recipient = email.EmailRecipient(email='*****@*****.**')
     message = email.prepare_email(recipient, 'email/band_request.md',
                                   form.cleaned_data)
     email.send_messages_async([message])
     return render(self.request, 'help/confirm_band_request.html')
Пример #5
0
def send_test_email(request):
    template = 'email/email_test.md'
    send_messages_async(
        [prepare_email(request.user.as_email_recipient(), template)])

    return HttpResponse(_("test email sent"))
Пример #6
0
def email_admins_about_joiner(the_band, the_joiner):
    template = 'email/joiner.md'
    the_admins = [a.member for a in the_band.band_admins]
    send_messages_async(
        joiner_email(the_band, a, the_joiner, template) for a in the_admins)
Пример #7
0
def send_emails_from_plans(plans_query, template):
    contactable = plans_query.filter(assoc__status=AssocStatusChoices.CONFIRMED,
                                     assoc__email_me=True)
    send_messages_async(email_from_plan(p, template) for p in contactable)