pretix allows event organizers to configure how they want to send emails to their users in multiple ways. Therefore, all emails should be sent through the following function.
If the email you send is related to an order, you should also take a look at the
send_mail() of the order model.
Sends out an email to a user. The mail will be sent synchronously or asynchronously depending on the installation.
- email – The email address of the recipient
- subject – The email subject. Should be localized to the recipients’s locale or a lazy object that will be localized by being casted to a string.
- template – The filename of a template to be used. It will be rendered with the locale given in the locale
argument and the context given in the next argument. Alternatively, you can pass a LazyI18nString and
contextwill be used as the argument to a Python
.format_map()call on the template.
- context – The context for rendering the template (see
- event – The event this email is related to (optional). If set, this will be used to determine the sender, a possible prefix for the subject and the SMTP server that should be used to send this email.
- order – The order this email is related to (optional). If set, this will be used to include a link to the order below the email.
- order – The order position this email is related to (optional). If set, this will be used to include a link to the order position instead of the order below the email.
- headers – A dict of custom mail headers to add to the mail
- locale – The locale to be used while evaluating the subject and the template
- sender – Set the sender email address. If not set and
eventis set, the event’s default will be used, otherwise the system default.
- invoices – A list of invoices to attach to this email.
- attach_tickets – Whether to attach tickets to this email, if they are available to download.
MailOrderException – on obvious, immediate failures. Not raising an exception does not necessarily mean that the email has been sent, just that it has been queued by the email backend.