# If there is nobody left to notify, return.
return unless ($flag->{'addressee'} || $flag->type->cc_list);
+ my @recipients = split(/[, ]+/, $flag->type->cc_list);
+ # Only notify if the addressee is allowed to receive the email.
+ if ($flag->{'addressee'} && $flag->{'addressee'}->email_enabled) {
+ push @recipients, $flag->{'addressee'}->email;
+ }
# Process and send notification for each recipient
- foreach my $to ($flag->{'addressee'} ? $flag->{'addressee'}->email : '',
- split(/[, ]+/, $flag->type->cc_list))
+ foreach my $to (@recipients)
{
next unless $to;
my $vars = { 'flag' => $flag,