aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Utils
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/Utils')
-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;