Envoi de courriels

Les courriels envoyés via l’application Érudit doivent être déclarés au moyent du helper core.email.Email. Voici un exemple d’utilisation :

from core.email import Email

email = Email(
  ['[email protected]', ],
  html_template='path/to/content_template.html',
  subject_template='path/to/subject_template.html',
  extra_context={'foo': 'bar'})
email.send()  # Triggers the sending

Référence

class core.email.email.Email(recipient, html_template, text_template=None, subject='', from_email=None, subject_template=None, extra_context={}, language=None, attachments={})

A simple wrapper around the post_office.mail.send function.

This allow to perform additional operations such as generating the text content of an email using its HTML content.