aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Utils/Email.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2015-08-19 16:51:30 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2015-08-19 16:51:30 +0100
commit1e772950bf8011078538ea2921d03fe0af6b1c66 (patch)
treed267761e8f7726b151e15f65a0dfc1673bc80757 /perllib/Utils/Email.pm
parent114cd8afdc3b108f6685d1973b3d7baf118971bb (diff)
parentd9f5d6805f8d897e81e00208ab138bada05f8e9d (diff)
Merge branch '1070-dmarc-workaround'
Diffstat (limited to 'perllib/Utils/Email.pm')
-rw-r--r--perllib/Utils/Email.pm22
1 files changed, 22 insertions, 0 deletions
diff --git a/perllib/Utils/Email.pm b/perllib/Utils/Email.pm
new file mode 100644
index 000000000..466c05ad1
--- /dev/null
+++ b/perllib/Utils/Email.pm
@@ -0,0 +1,22 @@
+package Utils::Email;
+
+use Email::Address;
+use Net::DNS::Resolver;
+
+# DMARC stabbity stab
+sub test_dmarc {
+ my $email = shift;
+
+ my $addr = (Email::Address->parse($email))[0];
+ return unless $addr;
+
+ my $domain = $addr->host;
+ my @answers = Net::DNS::Resolver->new->send("_dmarc.$domain", 'TXT')->answer;
+ @answers = map { $_->txtdata } @answers;
+ my $dmarc = join(' ', @answers);
+ return unless $dmarc =~ /p *= *reject/;
+
+ return 1;
+}
+
+1;