Example #1
0
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)
Example #2
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')
Example #3
0
 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_new, register_link=self.no_account)
         email_subject = replace_placeholders('event-persons-email', form.subject.data, person=recipient,
                                              event=self.event_new, register_link=self.no_account)
         tpl = get_template_module('events/persons/emails/email.html', subject=email_subject, body=email_body)
         email = make_email(to_list=recipient.email, from_address=form.from_address.data, template=tpl, html=True)
         send_email(email, self.event_new, 'Event Persons')
Example #4
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)
Example #5
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_new, subject=subject, body=body)
Example #6
0
 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')
Example #7
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')
Example #8
0
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)
Example #9
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)
         template = get_template_module('events/registration/emails/custom_email.html',
                                        email_subject=form.subject.data, email_body=email_body)
         email = make_email(to_list=registration.email, cc_list=form.cc_addresses.data,
                            from_address=form.from_address.data, template=template, html=True)
         send_email(email, self.event, 'Registration')
Example #10
0
 def _process(self):
     registration = self.registrations[0]
     email_body = replace_placeholders('registration-email', request.form['body'], regform=self.regform,
                                       registration=registration)
     tpl = get_template_module('events/registration/emails/custom_email.html', email_subject=request.form['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)
Example #11
0
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)
Example #12
0
 def _process(self):
     if not self.registrations:
         raise UserValueError(_("The selected registrants have been removed."))
     registration = self.registrations[0]
     email_body = replace_placeholders('registration-email', request.form['body'], regform=self.regform,
                                       registration=registration)
     tpl = get_template_module('events/registration/emails/custom_email.html', email_subject=request.form['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)
Example #13
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)
Example #14
0
 def _send_emails(self, form, recipients):
     for recipient in recipients:
         email_body = replace_placeholders('survey-link-email',
                                           form.body.data,
                                           event=self.event_new,
                                           survey=self.survey)
         email_subject = replace_placeholders('survey-link-email',
                                              form.subject.data,
                                              event=self.event_new,
                                              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_new, 'Surveys')
Example #15
0
 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_new,
                                           register_link=self.no_account)
         email_subject = replace_placeholders('event-persons-email',
                                              form.subject.data,
                                              person=recipient,
                                              event=self.event_new,
                                              register_link=self.no_account)
         tpl = get_template_module('events/persons/emails/email.html',
                                   subject=email_subject,
                                   body=email_body)
         email = make_email(to_list=recipient.email,
                            from_address=form.from_address.data,
                            template=tpl,
                            html=True)
         send_email(email, self.event_new, 'Event Persons')
Example #16
0
def notify_invitation(invitation, email_body, from_address):
    """Send a notification about a new registration invitation."""
    email_body = replace_placeholders('registration-invitation-email',
                                      email_body,
                                      invitation=invitation)
    template = get_template_module(
        'events/registration/emails/invitation.html', email_body=email_body)
    email = make_email(invitation.email,
                       from_address=from_address,
                       template=template,
                       html=True)
    send_email(email, invitation.registration_form.event_new, 'Registration',
               session.user)
Example #17
0
 def _process(self):
     if not self.registrations:
         raise UserValueError(_("The selected registrants have been removed."))
     registration = self.registrations[0]
     email_body = replace_placeholders(
         "registration-email", request.form["body"], regform=self.regform, registration=registration
     )
     tpl = get_template_module(
         "events/registration/emails/custom_email.html", email_subject=request.form["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)
 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('cern-access-email',
                                       request.form['body'],
                                       regform=self.regform,
                                       registration=registration)
     email_subject = replace_placeholders('cern-access-email',
                                          request.form['subject'],
                                          regform=self.regform,
                                          registration=registration)
     tpl = get_template_module(
         'cern_access:emails/identity_data_form_email.html',
         registration=registration,
         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)
Example #19
0
 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')
Example #20
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)
         template = get_template_module(
             'events/registration/emails/custom_email.html',
             email_subject=form.subject.data,
             email_body=email_body)
         email = make_email(to_list=registration.email,
                            cc_list=form.cc_addresses.data,
                            from_address=form.from_address.data,
                            template=template,
                            html=True)
         send_email(email, self.event, 'Registration')
Example #21
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_body = '<img src="'+ request.url_root + 'event/' + str(self.event.id) + '/images/' + 'event-banner.png' + '" alt="">' + form.body.data
         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')
Example #22
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)
         template = get_template_module(
             'events/registration/emails/custom_email.html',
             email_subject=form.subject.data,
             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')
Example #23
0
 def adjust_payment_form_data(self, data):
     data['details'] = replace_placeholders('manual-payment-details', data['event_settings']['details'],
                                            regform=data['registration'].registration_form,
                                            registration=data['registration'])
Example #24
0
 def adjust_payment_form_data(self, data):
     data['details'] = replace_placeholders(
         'manual-payment-details',
         data['event_settings']['details'],
         regform=data['registration'].registration_form,
         registration=data['registration'])