def _notify_registration(registration, template_name, to_managers=False, attach_rejection_reason=False): from indico.modules.events.registration.util import get_ticket_attachments attachments = [] regform = registration.registration_form tickets_handled = values_from_signal(signals.event.is_ticketing_handled.send(regform), single_value=True) if (not to_managers and regform.tickets_enabled and regform.ticket_on_email and not any(tickets_handled) and registration.state == RegistrationState.complete): attachments += get_ticket_attachments(registration) if not to_managers and registration.registration_form.attach_ical: event_ical = event_to_ical(registration.event) attachments.append(('event.ics', event_ical, 'text/calendar')) tpl = get_template_module(f'events/registration/emails/{template_name}', registration=registration, attach_rejection_reason=attach_rejection_reason) to_list = registration.email if not to_managers else registration.registration_form.manager_notification_recipients from_address = registration.registration_form.notification_sender_address if not to_managers else None mail = make_email(to_list=to_list, template=tpl, html=True, from_address=from_address, attachments=attachments) user = session.user if session else None signals.core.before_notification_send.send('notify-registration', email=mail, registration=registration, template_name=template_name, attach_rejection_reason=attach_rejection_reason) send_email(mail, event=registration.registration_form.event, module='Registration', user=user, log_metadata={'registration_id': registration.id})
def send(self): """Send the reminder to its recipients.""" self.is_sent = True recipients = self.all_recipients if not recipients: logger.info('Notification %s has no recipients; not sending anything', self) return email_tpl = make_reminder_email(self.event, self.include_summary, self.include_description, self.message) attachments = [] if self.attach_ical: event_ical = event_to_ical(self.event, skip_access_check=True, method='REQUEST', organizer=(core_settings.get('site_title'), config.NO_REPLY_EMAIL)) attachments.append(MIMECalendar('event.ics', event_ical)) for recipient in recipients: email = self._make_email(recipient, email_tpl, attachments) send_email(email, self.event, 'Reminder', self.creator, log_metadata={'reminder_id': self.id})
def send(self): """Send the reminder to its recipients.""" self.is_sent = True recipients = self.all_recipients if not recipients: logger.info( 'Notification %s has no recipients; not sending anything', self) return email_tpl = make_reminder_email(self.event, self.include_summary, self.include_description, self.message) attachments = [] if self.attach_ical: event_ical = event_to_ical(self.event) attachments.append(('event.ics', event_ical, 'text/calendar')) email = make_email(bcc_list=recipients, from_address=self.reply_to_address, template=email_tpl, attachments=attachments) send_email(email, self.event, 'Reminder', self.creator)
def _process(self, scope, detail): if not scope and detail == 'contributions': scope = CalendarScope.contribution event_ical = event_to_ical(self.event, session.user, scope) return send_file('event.ics', BytesIO(event_ical), 'text/calendar')
def _process(self): detailed = request.args.get('detail') == 'contributions' event_ical = event_to_ical(self.event, session.user, detailed) return send_file('event.ics', BytesIO(event_ical), 'text/calendar')