email

class gratipay.email.ConsoleMailer(fp=<open file '<stdout>', mode 'w'>)[source]

Dumps mail to stdout.

class gratipay.email.Queue(env, db, tell_sentry, root)[source]

Model an outbound email queue.

flush()[source]

Load messages queued for sending, and send them.

purge()[source]

Remove all messages from the queue.

put(to, template, _user_initiated=True, **context)[source]

Put an email message on the queue.

Parameters:
  • to (Participant) – the participant to send the email message to
  • template (unicode) – the name of the template to use when rendering the email, corresponding to a filename in emails/ without the file extension
  • _user_initiated (bool) – user-initiated emails are throttled; system-initiated messages don’t count against throttling
  • context (dict) – the values to use when rendering the template
Raises:

Throttled – if the participant already has a few messages in the queue (that they put there); the specific number is tunable with the EMAIL_QUEUE_ALLOW_UP_TO envvar.

Returns:

None

gratipay.email.compile_email_spt(fpath)[source]

Compile an email template from a simplate.

Parameters:fpath (unicode) – the filesystem path of the simplate