def _render_action_email(action, attendee, outreach_email, template): if isinstance(template, str): template = Engine.get_default().get_template(template) ctx = { "action": action, "contact": attendee.contact, "base_url": base_url(), "outreach_email": outreach_email, } msg_body = template.render(Context(ctx)) return msg_body
def notify_circle_job(job): circle = job.circle addresses = circle.get_notification_addresses() addresses.add(job.creator.email) subject = '[XR] Job filled by {}'.format(job.filled) title = job.title or job.id message = '''{who} has signed up to fill job "{title}" in {circle} {job} {baseurl}{url} '''.format(who=job.filled, title=title, circle=circle, job=job.job, baseurl=base_url(), url=job.get_absolute_url()) send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, addresses)
def notify_new_volunteer(volunteer): contact = volunteer.contact outreach_circle = get_circle('outreach') subject = '[XR] New Volunteer Request: {}'.format(contact) message = '''{who} <{email}> has signed up to volunteer. View all new requests at: {baseurl}/admin/circles/volunteerrequest/?status__exact=n Edit this request at: {baseurl}/admin/circles/volunteerrequest/edit/{pk}/ '''.format(who=contact, email=contact.email, baseurl=base_url(), pk=volunteer.id) send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, outreach_circle.get_notification_addresses())
def notify_new_signup(outreach_circle, signup): contact = signup.contact if signup.data.get('working_group', '') == 'UNKNOWN': wg_message = 'They will need help finding a working group\n' else: wg_message = '' subject = '[XR] New Self-Service Signup: {}'.format(contact) message = '''{who} <{email}> has signed up through the website. {wg_message} To export signup data: {baseurl}/circle/person/join/export/ '''.format(who=contact, email=contact.email, wg_message=wg_message, data=signup.data, baseurl=base_url()) send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, outreach_circle.get_notification_addresses())
def notify_circle_membership(circle, msg_type, members): addresses = circle.get_notification_addresses() contacts = Contact.objects.filter(pk__in=members) context = { 'contact': str(contacts[0]), 'contact_email': contacts[0].email, 'circle': str(circle), 'circle_url': '%s%s' % (base_url(), circle.get_absolute_url()), } if msg_type == 'pending member': context['action'] = 'wants to join' else: context['action'] = 'joined' message = ''' {contact} <{contact_email}> {action} {circle} {circle_url}#members '''.format(**context) subject = '[XR] %s added to %s' % (msg_type, circle) send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, addresses)
def send_commit_email(sender, instance, **kwargs): from .comm import notify_commitments if instance.promised or instance.mutual_commitment > 0 and not instance.notified: action_url = '%s%s' % (base_url(), instance.action.get_absolute_url()) notify_commitments(instance.action, instance.mutual_commitment, action_url)