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)])
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)])
def email_from_plan(plan, template): gig = plan.gig with timezone.override(gig.band.timezone): latest_record = gig.history.latest() changes = generate_changes(latest_record, latest_record.prev_record) member = plan.assoc.member contact_name, contact_email = ((gig.contact.display_name, gig.contact.email) if gig.contact else ('??', None)) context = { 'gig': gig, 'changes': changes, 'changes_title': join_trans(_(', '), (c[0] for c in changes)), 'single_day': is_single_day(gig), 'contact_name': contact_name, 'plan': plan, 'status': plan.status, 'status_label': PlanStatusChoices(plan.status).label, **PlanStatusChoices.__members__, } return prepare_email(member.as_email_recipient(), template, context, reply_to=[contact_email])
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')
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"))
def joiner_email(the_band, the_admin, the_joiner, template): context = {'band': the_band, 'joiner': the_joiner} return prepare_email(the_admin.as_email_recipient(), template, context)