Click here to get back home

ANNOUNCE: new module: Mail::SendVarious

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
ANNOUNCE: new module: Mail::SendVarious (null 10-26-2006
Posted by (null on October 26, 2006, 11:08 pm
Please log in for more thread options


Newly release on cpan...

NAME
Mail::SendVarious - send mail via STMP and sendmail

SYNOPSIS
use Mail::SendVarious;

sendmail(
from => 'user@host',
From => 'First Last',
to => 'user@host, user@host',
cc => 'user@host, user@host',
xheader => 'Some header stuff',
body => 'Some body stuff here'
);

sendmail(
envelope_to => 'user@host, user@host',
message => 'Complete header and body stuff',
);

sendmail(
envelope_to => 'user@host, user@host',
header => 'Complete header stuff',
body => 'Complete body stuff',
);

use Mail::SendVarious qw(make_message);
($from, $message, @envelope_to) = make_message(%args);

DESCRIPTION
Mail::SendVarious will try to send mail multiple ways. First it tries
via SMTP. If that doesn't work then it tries using "/usr/sbin/sendmail".

The "sendmail()" function can put together a message header or it you
can hand it one. Here are the options it can take:

envelope_from Sets the sender email address. If creating a header, also
sets the email address in the "From:" header if there is
no "from" option.

from Sets the envelope sender email address if "envelope_from"
isn't set. If creating a header, also sets the email
address in the "From:" header.

From Set the name over the sender in the "From:" header.

envelope_to Sets who the message is sent to.

to Sets the "To:" header. Also sets who the message is sent
to if "envelope_to" isn't set.

cc Sets the "Cc:" header. Also adds who the message is sent
to if "envelope_to" isn't set.

bcc Adds to who the message is sent to.

subject Specifies the "Subject:" header.

xheader Specifies extra header lines to be added if a header is
generated.

header Specifies the complete message header. "xheader" will be
ignored. No "To:", "From:", "Cc:" or "Subject:" header
will be generated.

body Specifies the complete message body.

message Specifies the complete message. "header" and "body"
arguments will be ignored. No "To:", "From:", "Cc:" or
"Subject:" header will be generated.

build_header Specifies if a header should be generated with "To:",
"From:", "Cc:" and "Subject:". This overrides what what
otherwise might happen.

debuglogger Specifies a function to call for debug output. If not
set, no debug output is generated.

errorlogger Specifies a function to call for error output. If not
set, errors are reported on "STDERR".

hostlist Specifies a list of hosts to try to send to via SMTP.
This should be an array refrence. If not set,
@Mail::SendVarious::mail_hostlist is used. The default
for @Mail::SendVarious::mail_hostlist is 127.0.0.1.

mail_command Specifies a command to use if sending via SMTP fails.
This should be an array refrence. If not set,
@Mail::SendVarious::mail_command is used. The default for
@Mail::SendVarious::mail_command is "/usr/sbin/sendmail
-oeml -i".

no_rejects Normally when sending via SMTP, Mail::SendVarious will
skip over any recipients that are rejected. Sent
"no_rejects" and the SMTP server will be skipped instead.
If "no_rejects" is not set, then any rejected recipients
will end up in @Mail::SendVarious::to_rejected.

The return value from "sendmail()" is true if the message was sent and
false otherwise. If the message was not sent, then the variable
"Mail::SendVarious::mail_error" will be set to a description of the
problem.

EXPORT_OK
In addition to the standard export item of the "sendmail()" function,
the following are available explicitly:

$mail_error The last error.

make_message() An additional function "make_message()" is provided. It
takes the same arguemtns as "sendmail()" but does not
send mail. It just generates the message.

The following two snippets do the same thing:

{
my ($from, $message, @envelope_to) =
make_message(%args);
sendmail(
envelope_from => $from,
envelope_to => \@envelope_to,
message => $message,
);
}

and

sendmail(%args);

@to_rejected Any recipients that were rejected by the SMTP server.
(Only if "no_rejects" isn't set).

@mail_hostlist "(qw(127.0.0.1))"

@mail_command "(qw(/usr/sbin/sendmail -oeml -i))"

OTHER MODULES THAT DO SIMILAR THINGS
Send mail via SMTP: Mail::SMI, Mail::Transport::SMTP, Mail::SendEasy,
Mail::Sender, Mail::Send, Mail::Sendmail.

Send mail via /usr/sbin/sendmail: Mail::Transport::Sendmail.

Send via various methods (but only one at a time): Mail::Mailer.

Manage an outgoing mail spool: Mail::Spool.

AUTHOR
module may be used and copied on the same terms as Perl itself.

--



Similar ThreadsPosted
Mail:Sender - HTML Mail with alternatives problem July 21, 2004, 6:44 pm
Module problem - Can't locate Mail/Sender.pm in @INC October 22, 2004, 11:19 am
Perl module to send mail with Attachments April 25, 2007, 2:03 pm
ANNOUNCE Net::eBay perl module August 31, 2005, 1:39 pm
ANNOUNCE Net::eBay perl module August 31, 2005, 2:15 pm
[ANNOUNCE] New module Class::IntrospectionMethods December 6, 2004, 2:12 pm
ANNOUNCE: new module: Daemon::Generic October 26, 2006, 4:31 pm
ANNOUNCE: New module Sys::PortIO 0.1 uploaded to CPAN March 5, 2005, 11:34 am
ANNOUNCE - Perl module Google::Adwords v0.4 October 12, 2006, 9:23 am
ANNOUNCE - Perl module Google::Adwords v0.4 October 13, 2006, 9:45 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap