reviewboard.notifications.email.utils¶
Utilities for sending e-mail messages.
- build_recipients(user: User, review_request: ReviewRequest, extra_recipients: Optional[Collection[Union[User, Group]]] = None, limit_recipients_to: Optional[Collection[Union[User, Group]]] = None) Tuple[Collection[Union[User, Group]], Collection[Union[User, Group]]] [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: Group, review_request_id: Optional[int] = None) List[str] [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) – The ID of the review request being used for the notification. This is used to filter out users who have muted the review request.
- Returns:
A list of properly formatted e-mail addresses for all users in the review group.
- Return type:
- recipients_to_addresses(recipients: Collection[Union[User, Group]], review_request_id: Optional[int] = None) Set[str] [source]¶
Return the set of e-mail addresses for the recipients.
- send_email(email_builder: Callable, **kwargs) Tuple[Optional[EmailMessage], bool] [source]¶
Attempt to send an e-mail, logging any exceptions that occur.