Fix attendee mails not being sent if no order address set

This commit is contained in:
Raphael Michel
2022-02-16 17:15:49 +01:00
parent 14e2834a72
commit 62218ca0c6
2 changed files with 4 additions and 5 deletions

View File

@@ -976,7 +976,7 @@ class Order(LockModel, LoggedModel):
SendMailException, TolerantDict, mail, render_mail,
)
if not self.email:
if not self.email and not (position and position.attendee_email):
return
for k, v in self.event.meta_data.items():
@@ -1724,10 +1724,10 @@ class OrderPayment(models.Model):
email_context = get_email_context(event=self.order.event, order=self.order, position=position)
email_subject = _('Event registration confirmed: %(code)s') % {'code': self.order.code}
try:
self.order.send_mail(
position.send_mail(
email_subject, email_template, email_context,
'pretix.event.order.email.order_paid', user,
invoices=[], position=position,
invoices=[],
attach_tickets=True,
attach_ical=self.order.event.settings.mail_attach_ical
)

View File

@@ -955,12 +955,11 @@ def _order_placed_email_attendee(event: Event, order: Order, position: OrderPosi
email_subject = _('Your event registration: %(code)s') % {'code': order.code}
try:
order.send_mail(
position.send_mail(
email_subject, email_template, email_context,
log_entry,
invoices=[],
attach_tickets=True,
position=position,
attach_ical=event.settings.mail_attach_ical and (not event.settings.mail_attach_ical_paid_only or is_free),
attach_other_files=[a for a in [
event.settings.get('mail_attachment_new_order', as_type=str, default='')[len('file://'):]