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

213 lines
5.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of Mail::Send</TITLE>
</HEAD><BODY>
<H1>Mail::Send</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::Send - Simple electronic mail interface
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
require Mail::Send;
$msg = Mail::Send-&gt;new;
$msg = Mail::Send-&gt;new(Subject =&gt; 'example', To =&gt; 'timbo');
$msg-&gt;to('<A HREF="mailto:user@host">user@host</A>');
$msg-&gt;to('<A HREF="mailto:user@host">user@host</A>', '<A HREF="mailto:user2@example.com">user2@example.com</A>');
$msg-&gt;subject('example subject');
$msg-&gt;cc('<A HREF="mailto:user@host">user@host</A>');
$msg-&gt;bcc('<A HREF="mailto:someone@else">someone@else</A>');
$msg-&gt;set($header, @values);
$msg-&gt;add($header, @values);
$msg-&gt;delete($header);
# Launch mailer and set headers. The filehandle returned
# by open() is an instance of the Mail::Mailer class.
# Arguments to the open() method are passed to the Mail::Mailer
# constructor.
$fh = $msg-&gt;open; # some default mailer
$fh = $msg-&gt;open('sendmail'); # explicit
print $fh &quot;Body of message&quot;;
$fh-&gt;close # complete the message and send it
or die &quot;couldn't send whole message: $!\n&quot;;
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
Mail::Send creates e-mail messages without using the Mail::Header
knowledge, which means that all escaping and folding must be done by
you! Also: do not forget to escape leading dots. Simplicity has its price.
<P>
When you have time, take a look at Mail::Transport which is part of
the MailBox suite.
<A NAME="lbAE">&nbsp;</A>
<H2>METHODS</H2>
<A NAME="lbAF">&nbsp;</A>
<H3>Constructors</H3>
<DL COMPACT>
<DT id="1">Mail::Send-&gt;<B>new</B>(<FONT SIZE="-1">PAIRS</FONT>)<DD>
A list of header fields (provided as key-value <FONT SIZE="-1">PAIRS</FONT>) can be used to
initialize the object, limited to the few provided as method: <TT>&quot;to&quot;</TT>,
<TT>&quot;subject&quot;</TT>, <TT>&quot;cc&quot;</TT>, and <TT>&quot;bcc&quot;</TT>. For other header fields, use <B>add()</B>.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H3>Header fields</H3>
<DL COMPACT>
<DT id="2">$obj-&gt;<B>add</B>($fieldname, @values)<DD>
Add values to the list of defined values for the <TT>$fieldname</TT>.
<DT id="3">$obj-&gt;<B>bcc</B>(@values)<DD>
<DT id="4">$obj-&gt;<B>cc</B>(@values)<DD>
<DT id="5">$obj-&gt;<B>delete</B>($fieldname)<DD>
<DT id="6">$obj-&gt;<B>set</B>($fieldname, @values)<DD>
The <TT>@values</TT> will replace the old values for the <TT>$fieldname</TT>. Returned is
the <FONT SIZE="-1">LIST</FONT> of values after modification.
<DT id="7">$obj-&gt;<B>subject</B>(@values)<DD>
<DT id="8">$obj-&gt;<B>to</B>(@values)<DD>
</DL>
<A NAME="lbAH">&nbsp;</A>
<H3>Sending</H3>
<DL COMPACT>
<DT id="9">$obj-&gt;<B>open</B>(%options)<DD>
The <TT>%options</TT> are used to initiate a mailer object via
<B>Mail::Mailer::new()</B>. Then <B>Mail::Mailer::open()</B> is called
with the knowledge collected in this <TT>&quot;Mail::Send&quot;</TT> object.
<P>
Be warned: this module implements raw smtp, which means that you have
to escape lines which start with a dot, by adding one in front.
</DL>
<A NAME="lbAI">&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="lbAJ">&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="lbAK">&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="10"><A HREF="#lbAB">NAME</A><DD>
<DT id="11"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="12"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="13"><A HREF="#lbAE">METHODS</A><DD>
<DL>
<DT id="14"><A HREF="#lbAF">Constructors</A><DD>
<DT id="15"><A HREF="#lbAG">Header fields</A><DD>
<DT id="16"><A HREF="#lbAH">Sending</A><DD>
</DL>
<DT id="17"><A HREF="#lbAI">SEE ALSO</A><DD>
<DT id="18"><A HREF="#lbAJ">AUTHORS</A><DD>
<DT id="19"><A HREF="#lbAK">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>