aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Utils/Email.pm
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2017-05-28 21:31:42 +0200
committerMarius Halden <marius.h@lden.org>2017-05-28 21:31:42 +0200
commit987124b09a32248414faf4d0d6615d43b29ac6f6 (patch)
treea549db8af723c981d3b346e855f25d6fd5ff8aa7 /perllib/Utils/Email.pm
parentdbf56159e44c1560a413022451bf1a1c4cb22a52 (diff)
parenta085b63ce09f87e83b75cda9b9cd08aadfe75d61 (diff)
Merge tag 'v2.0.4' into fiksgatami-dev
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;