Mail::Verify(3pm)
π Mail::Verify β the perl manual page, bestie edition β¨
okay so this is Mail::Verify(3pm) from the User Contributed Perl Documentation section of the manual, and it is literally your new best friend for checking if an email address is real. no cap. π¦
πΈ NAME πΈ
Mail::Verify β a utility to verify an email address π
β¨ SYNOPSIS β¨
use Mail::Verify;
that's it. that's the whole vibe check. π
π DESCRIPTION π
so Mail::Verify gives you a CheckAddress function, and its whole job is verifying email addresses. it's giving detective energy. π
here's the order of operations, bestie, and it matters:
- first it checks the syntax of the email address. like, does this even look like an email.
- then it verifies there's at least one valid MX server that's actually accepting email for that domain. because a pretty address means nothing if nobody's home. π
and to do that second part, it uses Net::DNS and IO::Socket β it pulls a list of MX records (or, if that doesn't work out, it falls back on a host's A record) and checks them to make sure at least one SMTP server is out here accepting connections. periodt. π
π ERRORS π
here's the list of return codes and what they mean, and honestly this part is important so read it fr fr:
0β the email address appears to be valid. slay!! π1β no email address was supplied. bestie. you gave it nothing. π2β there is a syntaxical error in the email address.3β there are no DNS entries for the host in question (no MX records and no A records). the domain is giving ghost town. π»4β there are no live SMTP servers accepting connections for this email address. so sad, nobody answered the door. π
π«Ά EXAMPLES π«Ά
this example shows obtaining an email address from a form field and verifying it. classic main character move.
use CGI qw/:standard/;
use Mail::Verify;
my $q = new CGI;
[...]
my $email = $q->param("emailaddr");
my $email_ck = Mail::Verify::CheckAddress( $email );
if( $email_ck ) {
print '<h1>Form input error: Invalid email address.</h1>';
}
[...]
see how if the check comes back truthy it prints the form input error? yeah. iconic. π
π POD ERRORS π
hey! so the document above had some coding errors, and they're explained below. not me snitching on the docs but okay. π
- Around line 30:
'=item' outside of any '=over'
- Around line 34:
Expected text after =item, not a number
- Around line 38:
Expected text after =item, not a number
- Around line 42:
Expected text after =item, not a number
- Around line 46:
Expected text after =item, not a number
- Around line 50:
You forgot a '=back' before '=head1'
no judgement, we've all forgotten a =back before. π«Ά
and that's the whole page, bestie!! this one's from perl v5.36.0, dated 2022-12-05, and it lives in the Mail::Verify(3pm) corner of the manual. go verify some emails and stay hydrated. πβ¨πΈπ¦ππ π«Άπ
π¦ where this page comes from
- debian bookworm: libmail-verify-perl 0.02-7 Β· GPL OR Artistic-1.0-Perl
- ubuntu noble: libmail-verify-perl 0.02-7 Β· GPL OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms