1Mail::Util(3) User Contributed Perl Documentation Mail::Util(3)
2
3
4
6 Mail::Util - mail utility functions
7
9 Mail::Util
10 is a Exporter
11
13 use Mail::Util qw( ... );
14
16 This package provides several mail related utility functions. Any
17 function required must by explicitly listed on the use line to be
18 exported into the calling package.
19
21 mailaddress( [$address] )
22 Return a guess at the current users mail address. The user can
23 force the return value by setting the MAILADDRESS environment
24 variable. [2.10] You may set the $address via the parameter.
25
26 WARNING: When not supplied via the environment variable,
27 <mailaddress> looks at various configuration files and other
28 environmental data. Although this seems to be smart behavior, this
29 is not predictable enough (IMHO) to be used. Please set the
30 MAILADDRESS explicitly, and do not trust on the "automatic
31 detection", even when that produces a correct address (on the
32 moment)
33
34 example:
35
36 # in your main script
37 $ENV{MAILADDRESS} = 'me@example.com';
38
39 # everywhere else
40 use Mail::Util 'mailaddress';
41 print mailaddress;
42
43 # since v2.10
44 mailaddress "me@example.com";
45
46 maildomain()
47 Attempt to determine the current user mail domain string via the
48 following methods
49
50 · Look for the MAILDOMAIN environment variable, which can be set
51 from outside the program. This is by far the best way to
52 configure the domain.
53
54 · Look for a sendmail.cf file and extract DH parameter
55
56 · Look for a smail config file and usr the first host defined in
57 hostname(s)
58
59 · Try an SMTP connect (if Net::SMTP exists) first to mailhost
60 then localhost
61
62 · Use value from Net::Domain::domainname (if Net::Domain exists)
63
64 WARNING: On modern machines, there is only one good way to provide
65 information to this method: the first; always explicitly configure
66 the MAILDOMAIN.
67
68 example:
69
70 # in your main script
71 $ENV{MAILDOMAIN} = 'example.com';
72
73 # everywhere else
74 use Mail::Util 'maildomain';
75 print maildomain;
76
77 read_mbox($file)
78 Read $file, a binmail mailbox file, and return a list of
79 references. Each reference is a reference to an array containing
80 one message.
81
82 WARNING: This method does not quote lines which accidentally also
83 start with the message separator "From", so this implementation can
84 be considered broken. See Mail::Box::Mbox
85
87 This module is part of the MailTools distribution,
88 http://perl.overmeer.net/mailtools/.
89
91 The MailTools bundle was developed by Graham Barr. Later, Mark
92 Overmeer took over maintenance without commitment to further
93 development.
94
95 Mail::Cap by Gisle Aas <aas@oslonett.no>. Mail::Field::AddrList by
96 Peter Orbaek <poe@cit.dk>. Mail::Mailer and Mail::Send by Tim Bunce
97 <Tim.Bunce@ig.co.uk>. For other contributors see ChangeLog.
98
100 Copyrights 1995-2000 Graham Barr <gbarr@pobox.com> and 2001-2017 Mark
101 Overmeer <perl@overmeer.net>.
102
103 This program is free software; you can redistribute it and/or modify it
104 under the same terms as Perl itself. See
105 http://www.perl.com/perl/misc/Artistic.html
106
107
108
109perl v5.26.3 2018-01-22 Mail::Util(3)