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 per‐
26 formed on an address is to check that the email address is syntacti‐
27 cally 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
36 Returns true or false to indicate if address is an RFC822 valid
37 address.
38
39 validlist ( addresslist )
40
41 In scalar context, returns true if the parameter is an RFC822 valid
42 list of addresses.
43
44 In list context, returns an empty list on failure (an invalid address
45 was found); otherwise a list whose first element is the number of
46 addresses found and whose remaining elements are the addresses. This
47 is needed to disambiguate failure (invalid) from success with no
48 addresses found, because an empty string is a valid list.
49
51 Paul Warren, pdw@ex-parrot.com
52
54 Most of the test suite in test.pl is taken from RFC::RFC822::Address,
55 written by Abigail, abigail@foad.org
56
58 This program is copyright 2001-2002 by Paul Warren.
59
60 Permission is hereby granted, free of charge, to any person obtaining a
61 copy of this software and associated documentation files (the "Soft‐
62 ware"), to deal in the Software without restriction, including without
63 limitation the rights to use, copy, modify, merge, publish, distribute,
64 sublicense, and/or sell copies of the Software, and to permit persons
65 to whom the Software is furnished to do so, subject to the following
66 conditions: The above copyright notice and this permission notice shall
67 be included in all copies or substantial portions of the Software.
68
69 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
70 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MER‐
71 CHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
72 NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
73 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
74 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
75 DEALINGS IN THE SOFTWARE.
76
78 RFC::RFC822::Address, Mail::Address
79
80
81
82perl v5.8.8 2002-04-13 Address(3)