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 givenuser
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 inlimit_recipients_to
will be used.- Parameters:
user (
django.contrib.auth.models.User
) – The user sending the e-mail.review_request (
reviewboard.reviews.models.ReviewRequest
) – The review request the e-mail corresponds to.extra_recipients (
list
) – An optional list of extra recipients asUsers
andGroups
that will receive the e-mail.limit_recipients_to (
list
) – An optional list of recipients asUsers
andGroups
who will receive the e-mail in place of the normal recipients.
- Returns:
A 2-tuple of the To field and the CC field, as sets of
Users
andGroups
.- Return type:
- get_email_addresses_for_group(group, review_request_id=None)[source]¶
Build a list of e-mail addresses for the group.
- Parameters:
group (
reviewboard.reviews.models.Group
) – The review group to build the e-mail addresses for.review_request_id (
int
, optional) –
- Returns:
A list of properly formatted e-mail addresses for all users in the review group.
- Return type:
- recipients_to_addresses(recipients, review_request_id=None)[source]¶
Return the set of e-mail addresses for the recipients.
- send_email(email_builder, **kwargs)[source]¶
Attempt to send an e-mail, logging any exceptions that occur.