3 no warnings qw(redefine);
5 package RT::Action::SendEmail;
9 Overlay for RT::Action::SendEmail to implement a global email notifications
10 blacklist. All components that send email using the SendEmail action will
11 be affected by this blacklist.
13 The web interface uses these filters to decide which email addresses to
14 display as sendable. This gives us the added bonus of transparency. If
15 an e-mail address is blacklisted, it will never appear in the recipient
16 list on a ticket correspondance.
20 To enable the blacklist, add a configuration option to RT_SiteConfig.pm
22 Set(@NotifyBlacklist,(qw(reddit.com slashdot.org frank)));
24 If an email address regex matches any item in the list, no email is sent
28 This overlay implementation will need to be maintained if RT updates
29 the SendEmail action to filter addresses differently. The benefit of
30 using rt overlays is our library changes easily persist between rt versions,
31 and don't need to be reimplemented with each release of rt. The downside
32 of overlays if the underlying rt core functionality changes, our overlay
33 may break rt until it is removed or updated.
35 For information on RT library overlays,
36 see L<https://rt-wiki.bestpractical.com/wiki/CustomizingWithOverlays>
43 unless (ref $self->{RecipientFilter}) {
45 eval { @blacklist = @RT::NotifyBlacklist };
47 push @{$self->{RecipientFilter}}, {
51 for my $block (@blacklist) {
52 return "$email is blacklisted by NotifyBlacklist, skipping"
53 if $email =~ /$block/i;
60 push @{ $self->{RecipientFilter}}, {@_};