Jump to >

reviewboard.notifications.email.utils

Utilities for sending e-mail messages.

build_recipients(user, review_request, extra_recipients=None, limit_recipients_to=None)[source]

Build the recipient sets for an e-mail.

By default, the user sending the e-mail, the review request submitter (if they are active), all active reviewers, and all active members of review groups will be recipients of the e-mail.

If the limit_recipients_to parameter is provided, the given user and the review request submitter (if active) will still be recipients of the e-mail, but all reviewers and members of review groups will not. Instead, the recipients given in limit_recipients_to will be used.

Parameters:
Returns:

A 2-tuple of the To field and the CC field, as sets of Users and Groups.

Return type:

tuple

get_email_addresses_for_group(group, review_request_id=None)[source]

Build a list of e-mail addresses for the group.

Parameters:
Returns:

A list of properly formatted e-mail addresses for all users in the review group.

Return type:

list of unicode

recipients_to_addresses(recipients, review_request_id=None)[source]

Return the set of e-mail addresses for the recipients.

Parameters:recipients (list) – A list of Users and Groups.
Returns:The e-mail addresses for all recipients.
Return type:set
send_email(email_builder, **kwargs)[source]

Attempt to send an e-mail, logging any exceptions that occur.

Parameters:
  • email_builder (callable) – A function that generates an EmailMessage.
  • **kwargs (dict) – Keyword arguments to provide to email_builder.
Returns:

A tuple of:

  • The message that was generated (:py:class`EmailMessage`).
  • Whether or not the message was sent successfully (bool).

Return type:

tuple