1Address(3) User Contributed Perl Documentation Address(3)
2
3
4
6 Mail::RFC822::Address - Perl extension for validating email addresses
7 according to RFC822
8
10 use Mail::RFC822::Address qw(valid validlist);
11
12 if (valid("pdw@ex-parrot.com")) {
13 print "That's a valid address\n";
14 }
15
16 if (validlist("pdw@ex-parrot.com, other@elsewhere.com")) {
17 print "That's a valid list of addresses\n";
18 }
19
21 Mail::RFC822::Address validates email addresses against the grammar
22 described in RFC 822 using regular expressions. How to validate a user
23 supplied email address is a FAQ (see perlfaq9): the only sure way to
24 see if a supplied email address is genuine is to send an email to it
25 and see if the user recieves it. The one useful check that can be
26 performed on an address is to check that the email address is
27 syntactically valid. That is what this module does.
28
29 This module is functionally equivalent to RFC::RFC822::Address, but
30 uses regular expressions rather than the Parse::RecDescent parser.
31 This means that startup time is greatly reduced making it suitable for
32 use in transient scripts such as CGI scripts.
33
34 valid ( address )
35 Returns true or false to indicate if address is an RFC822 valid
36 address.
37
38 validlist ( addresslist )
39 In scalar context, returns true if the parameter is an RFC822 valid
40 list of addresses.
41
42 In list context, returns an empty list on failure (an invalid address
43 was found); otherwise a list whose first element is the number of
44 addresses found and whose remaining elements are the addresses. This
45 is needed to disambiguate failure (invalid) from success with no
46 addresses found, because an empty string is a valid list.
47
49 Paul Warren, pdw@ex-parrot.com
50
52 Most of the test suite in test.pl is taken from RFC::RFC822::Address,
53 written by Abigail, abigail@foad.org
54
56 This program is copyright 2001-2002 by Paul Warren.
57
58 Permission is hereby granted, free of charge, to any person obtaining a
59 copy of this software and associated documentation files (the
60 "Software"), to deal in the Software without restriction, including
61 without limitation the rights to use, copy, modify, merge, publish,
62 distribute, sublicense, and/or sell copies of the Software, and to
63 permit persons to whom the Software is furnished to do so, subject to
64 the following conditions: The above copyright notice and this
65 permission notice shall be included in all copies or substantial
66 portions of the Software.
67
68 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
69 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
70 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
71 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
72 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
73 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
74 DEALINGS IN THE SOFTWARE.
75
77 RFC::RFC822::Address, Mail::Address
78
79
80
81perl v5.38.0 2023-07-20 Address(3)