aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Utils/Email.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/Utils/Email.pm')
-rw-r--r--perllib/Utils/Email.pm12
1 files changed, 12 insertions, 0 deletions
diff --git a/perllib/Utils/Email.pm b/perllib/Utils/Email.pm
index a30e41c61..5e3df0205 100644
--- a/perllib/Utils/Email.pm
+++ b/perllib/Utils/Email.pm
@@ -34,4 +34,16 @@ sub _send {
return grep { $_->type eq $type } @answers;
}
+sub same_domain {
+ my ($email, $list) = @_;
+ my $addr = (Email::Address->parse($email->[0]))[0];
+ return unless $addr;
+ my $domain = $addr->host;
+ foreach (@$list) {
+ my $addr = (Email::Address->parse($_->[0]))[0];
+ next unless $addr;
+ return 1 if $domain eq $addr->host;
+ }
+}
+
1;