def _send_emails(self, form, recipients):
     for recipient in recipients:
         if self.no_account and isinstance(recipient, EventPerson):
             recipient.invited_dt = now_utc()
         email_body = replace_placeholders('event-persons-email', form.body.data, person=recipient,
                                           event=self.event, register_link=self.no_account)
         email_subject = replace_placeholders('event-persons-email', form.subject.data, person=recipient,
                                              event=self.event, register_link=self.no_account)
         tpl = get_template_module('emails/custom.html', subject=email_subject, body=email_body)
         bcc = [session.user.email] if form.copy_for_sender.data else []
         email = make_email(to_list=recipient.email, bcc_list=bcc, from_address=form.from_address.data,
                            template=tpl, html=True)
         send_email(email, self.event, 'Event Persons')
예제 #2
0
def get_abstract_notification_tpl_module(email_tpl, abstract):
    """Get the Jinja template module for a notification email

    :param email_tpl: the abstract email template used to populate the
                      email subject/body
    :param abstract: the abstract the notification email is for
    """
    subject = replace_placeholders('abstract-notification-email', email_tpl.subject,
                                   abstract=abstract, escape_html=False)
    body = replace_placeholders('abstract-notification-email', email_tpl.body,
                                abstract=abstract, escape_html=False)
    return get_template_module('events/abstracts/emails/abstract_notification.txt',
                               event=email_tpl.event, subject=subject, body=body)
예제 #3
0
 def _process(self):
     if not self.registrations:
         raise NoReportError.wrap_exc(BadRequest(_("The selected registrants have been removed.")))
     registration = self.registrations[0]
     email_body = replace_placeholders('registration-email', request.form['body'], regform=self.regform,
                                       registration=registration)
     email_subject = replace_placeholders('registration-email', request.form['subject'], regform=self.regform,
                                          registration=registration)
     tpl = get_template_module('events/registration/emails/custom_email.html', email_subject=email_subject,
                               email_body=email_body)
     html = render_template('events/registration/management/email_preview.html', subject=tpl.get_subject(),
                            body=tpl.get_body())
     return jsonify(html=html)
예제 #4
0
 def _send_emails(self, form):
     for registration in self.registrations:
         email_body = replace_placeholders('registration-email', form.body.data, regform=self.regform,
                                           registration=registration)
         email_subject = replace_placeholders('registration-email', form.subject.data, regform=self.regform,
                                              registration=registration)
         template = get_template_module('events/registration/emails/custom_email.html',
                                        email_subject=email_subject, email_body=email_body)
         bcc = [session.user.email] if form.copy_for_sender.data else []
         attachments = (get_ticket_attachments(registration)
                        if 'attach_ticket' in form and form.attach_ticket.data
                        else None)
         email = make_email(to_list=registration.email, cc_list=form.cc_addresses.data, bcc_list=bcc,
                            from_address=form.from_address.data, template=template, html=True,
                            attachments=attachments)
         send_email(email, self.event, 'Registration')
def notify_invitation(invitation, email_subject, email_body, from_address):
    """Send a notification about a new registration invitation."""
    email_body = replace_placeholders('registration-invitation-email',
                                      email_body,
                                      invitation=invitation)
    email_subject = replace_placeholders('registration-invitation-email',
                                         email_subject,
                                         invitation=invitation)
    template = get_template_module('emails/custom.html',
                                   subject=email_subject,
                                   body=email_body)
    email = make_email(invitation.email,
                       from_address=from_address,
                       template=template,
                       html=True)
    send_email(email, invitation.registration_form.event, 'Registration',
               session.user)
def make_email_template(template, agreement, email_body=None):
    func = get_template_module if not current_plugin else get_plugin_template_module
    if not email_body:
        email_body = agreement.definition.get_email_body_template(
            agreement.event).get_body()
    email_body = replace_placeholders('agreement-email',
                                      email_body,
                                      definition=agreement.definition,
                                      agreement=agreement)
    return func(template, email_body=email_body)
예제 #7
0
 def _send_emails(self, form, recipients):
     for recipient in recipients:
         email_body = replace_placeholders('survey-link-email',
                                           form.body.data,
                                           event=self.event,
                                           survey=self.survey)
         email_subject = replace_placeholders('survey-link-email',
                                              form.subject.data,
                                              event=self.event,
                                              survey=self.survey)
         tpl = get_template_module('emails/custom.html',
                                   subject=email_subject,
                                   body=email_body)
         bcc = [session.user.email] if form.copy_for_sender.data else []
         email = make_email(to_list=recipient,
                            bcc_list=bcc,
                            from_address=form.from_address.data,
                            template=tpl,
                            html=True)
         send_email(email, self.event, 'Surveys')