man-pages/man3/Mail::Util.3pm.html
2021-03-31 01:06:50 +01:00

227 lines
5.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of Mail::Util</TITLE>
</HEAD><BODY>
<H1>Mail::Util</H1>
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2019-07-25<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
Mail::Util - mail utility functions
<A NAME="lbAC">&nbsp;</A>
<H2>INHERITANCE</H2>
<PRE>
Mail::Util
is a Exporter
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
use Mail::Util qw( ... );
</PRE>
<A NAME="lbAE">&nbsp;</A>
<H2>DESCRIPTION</H2>
This package provides several mail related utility functions. Any function
required must by explicitly listed on the use line to be exported into
the calling package.
<A NAME="lbAF">&nbsp;</A>
<H2>FUNCTIONS</H2>
<DL COMPACT>
<DT id="1"><B>mailaddress</B>( [$address] )<DD>
Return a guess at the current users mail address. The user can force
the return value by setting the <FONT SIZE="-1">MAILADDRESS</FONT> environment variable.
[2.10] You may set the <TT>$address</TT> via the parameter.
<P>
<FONT SIZE="-1">WARNING:</FONT>
When not supplied via the environment variable, &lt;mailaddress&gt; looks at
various configuration files and other environmental data. Although this
seems to be smart behavior, this is not predictable enough (<FONT SIZE="-1">IMHO</FONT>) to
be used. Please set the <FONT SIZE="-1">MAILADDRESS</FONT> explicitly, and do not trust on
the ``automatic detection'', even when that produces a correct address
(on the moment)
<P>
example:
<P>
<PRE>
# in your main script
$ENV{MAILADDRESS} = '<A HREF="mailto:me@example.com">me@example.com</A>';
# everywhere else
use Mail::Util 'mailaddress';
print mailaddress;
# since v2.10
mailaddress &quot;<A HREF="mailto:me@example.com">me@example.com</A>&quot;;
</PRE>
<DT id="2"><B>maildomain</B>()<DD>
Attempt to determine the current user mail domain string via the following
methods
<DL COMPACT><DT id="3"><DD>
<DL COMPACT>
<DT id="4">&bull;<DD>
Look for the <FONT SIZE="-1">MAILDOMAIN</FONT> environment variable, which can be set from outside the program. This is by far the best way to configure the domain.
<DT id="5">&bull;<DD>
Look for a sendmail.cf file and extract <FONT SIZE="-1">DH</FONT> parameter
<DT id="6">&bull;<DD>
Look for a smail config file and usr the first host defined in hostname(s)
<DT id="7">&bull;<DD>
Try an <FONT SIZE="-1">SMTP</FONT> connect (if Net::SMTP exists) first to mailhost then localhost
<DT id="8">&bull;<DD>
Use value from Net::Domain::domainname (if Net::Domain exists)
</DL>
</DL>
<DL COMPACT><DT id="9"><DD>
<P>
<FONT SIZE="-1">WARNING:</FONT>
On modern machines, there is only one good way to provide information to
this method: the first; always explicitly configure the <FONT SIZE="-1">MAILDOMAIN.</FONT>
<P>
example:
<P>
<PRE>
# in your main script
$ENV{MAILDOMAIN} = 'example.com';
# everywhere else
use Mail::Util 'maildomain';
print maildomain;
</PRE>
</DL>
<DT id="10"><B>read_mbox</B>($file)<DD>
Read <TT>$file</TT>, a binmail mailbox file, and return a list of references.
Each reference is a reference to an array containing one message.
<P>
<FONT SIZE="-1">WARNING:</FONT>
This method does not quote lines which accidentally also start with the
message separator <TT>&quot;From&quot;</TT>, so this implementation can be considered
broken. See Mail::Box::Mbox
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>SEE ALSO</H2>
This module is part of the MailTools distribution,
<I><A HREF="http://perl.overmeer.net/mailtools/">http://perl.overmeer.net/mailtools/</A></I>.
<A NAME="lbAH">&nbsp;</A>
<H2>AUTHORS</H2>
The MailTools bundle was developed by Graham Barr. Later, Mark
Overmeer took over maintenance without commitment to further development.
<P>
Mail::Cap by Gisle Aas &lt;<A HREF="mailto:aas@oslonett.no">aas@oslonett.no</A>&gt;.
Mail::Field::AddrList by Peter Orbaek &lt;<A HREF="mailto:poe@cit.dk">poe@cit.dk</A>&gt;.
Mail::Mailer and Mail::Send by Tim Bunce &lt;<A HREF="mailto:Tim.Bunce@ig.co.uk">Tim.Bunce@ig.co.uk</A>&gt;.
For other contributors see ChangeLog.
<A NAME="lbAI">&nbsp;</A>
<H2>LICENSE</H2>
Copyrights 1995-2000 Graham Barr &lt;<A HREF="mailto:gbarr@pobox.com">gbarr@pobox.com</A>&gt; and
2001-2017 Mark Overmeer &lt;<A HREF="mailto:perl@overmeer.net">perl@overmeer.net</A>&gt;.
<P>
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See <I><A HREF="http://www.perl.com/perl/misc/Artistic.html">http://www.perl.com/perl/misc/Artistic.html</A></I>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="11"><A HREF="#lbAB">NAME</A><DD>
<DT id="12"><A HREF="#lbAC">INHERITANCE</A><DD>
<DT id="13"><A HREF="#lbAD">SYNOPSIS</A><DD>
<DT id="14"><A HREF="#lbAE">DESCRIPTION</A><DD>
<DT id="15"><A HREF="#lbAF">FUNCTIONS</A><DD>
<DT id="16"><A HREF="#lbAG">SEE ALSO</A><DD>
<DT id="17"><A HREF="#lbAH">AUTHORS</A><DD>
<DT id="18"><A HREF="#lbAI">LICENSE</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:47 GMT, March 31, 2021
</BODY>
</HTML>