
=head1 NAME

Mail::Transport::Send - send a message

=head1 CLASS INHERITANCE

 Mail::Transport::Send
   is a Mail::Transport
   is a Mail::Reporter

 Mail::Transport::Send is extended by
   Mail::Transport::Exim
   Mail::Transport::Mailx
   Mail::Transport::Qmail
   Mail::Transport::SMTP
   Mail::Transport::Sendmail

=head1 SYNOPSIS

 my $message = Mail::Message->new(...);

 # Some extensions implement sending:
 $message->send;
 $message->send(via => 'sendmail');

 my $sender = Mail::Transport::SMTP->new(...);
 $sender->send($message);

=head1 DESCRIPTION

Send a message to the destinations as specified in the header.  The
C<Mail::Transport::Send> module is capable of autodetecting which of the
following modules work on your system; you may simply call C<send>
without C<via> options to get a message transported.

=over 4

=item * Mail::Transport::Sendmail

Use sendmail to process and deliver the mail.  This requires the
C<sendmail> program to be installed on your system.  Whether this
is an original sendmail, or a replacement from Postfix does matter.

=item * Mail::Transport::Exim

Use C<exim> to distribute the message.

=item * Mail::Transport::Qmail

Use C<qmail-inject> to distribute the message.

=item * Mail::Transport::SMTP

In this case, Perl is handling mail transport on its own.  This is less
desired but more portable than sending with sendmail or qmail.

The advantage is that this sender is environment independent, and easier to
configure.  However, there is no daemon involved which means that your
program will wait until the message is delivered, and the message is
lost when your program is interrupted during delivery (which may
take hours to complete).

=item * Mail::Transport::Mailx

Use the external C<mail>, C<mailx>, or C<Mail> programs to send the
message.  Usually, the result is poor, because some versions of these
programs do not support MIME headers.  Besides, these programs are
known to have exploitable security breaches.

=back

=head1 METHODS

=head2 Initiation

=over 4

=item B<new> OPTIONS

(Class method)

 OPTION               DEFAULT
 executable           C<undef>
 hostname             'localhost'
 interval             30
 log                  'WARNINGS'
 password             undef
 port                 undef
 proxy                undef
 retry                <false>
 timeout              120
 trace                'WARNINGS'
 username             undef
 via                  'sendmail'

=over 4

=item B<executable> =E<gt> FILENAME

See Mail::Transport::new(executable)

=item B<hostname> =E<gt> HOSTNAME|ARRAY-OF-HOSTNAMES

See Mail::Transport::new(hostname)

=item B<interval> =E<gt> SECONDS

See Mail::Transport::new(interval)

=item B<log> =E<gt> LEVEL

See Mail::Reporter::new(log)

=item B<password> =E<gt> STRING

See Mail::Transport::new(password)

=item B<port> =E<gt> INTEGER

See Mail::Transport::new(port)

=item B<proxy> =E<gt> PATH

See Mail::Transport::new(proxy)

=item B<retry> =E<gt> NUMBER|undef

See Mail::Transport::new(retry)

=item B<timeout> =E<gt> SECONDS

See Mail::Transport::new(timeout)

=item B<trace> =E<gt> LEVEL

See Mail::Reporter::new(trace)

=item B<username> =E<gt> STRING

See Mail::Transport::new(username)

=item B<via> =E<gt> CLASS|NAME

See Mail::Transport::new(via)

=back

=back

=head2 Server Connection

=over 4

=item B<findBinary> NAME [, DIRECTORIES]

See Mail::Transport::findBinary()

=item B<remoteHost> 

See Mail::Transport::remoteHost()

=item B<retry> 

See Mail::Transport::retry()

=back

=head2 Sending Mail

=over 4

=item B<putContent> MESSAGE, FILEHANDLE, OPTIONS

Print the content of the MESSAGE to the FILEHANDLE.

 OPTION               DEFAULT
 body_only            <false>
 undisclosed          <false>

=over 4

=item B<body_only> =E<gt> BOOLEAN

Print only the body of the message, not the whole.

=item B<undisclosed> =E<gt> BOOLEAN

Do not print the C<Bcc> and C<Resent-Bcc> lines.  Default false, which
means that they are printed.

=back

=item B<send> MESSAGE, OPTIONS

Transmit the MESSAGE, which may be anything what can be coerced into a
Mail::Message, so including Mail::Internet and MIME::Entity
messages.  It returns true when the transmission was successfully completed.

As OPTIONS, you can specify an C<interval> and a C<retry> count, which
will overrule the setting at initiation of the transporter object.

=item B<trySend> MESSAGE, OPTIONS

Try to send the message. This will return true if successful, and
false in case some problems where detected.  The C<$?> contains
the exit status of the command which was started.

=back

=head2 Logging and Tracing

=over 4

=item B<defaultTrace> [LEVEL, [LEVEL]

See Mail::Reporter::defaultTrace()

=item B<errors> 

See Mail::Reporter::errors()

=item B<log> [LEVEL [,STRINGS]]

See Mail::Reporter::log()

=item B<report> [LEVEL]

See Mail::Reporter::report()

=item B<reportAll> [LEVEL]

See Mail::Reporter::reportAll()

=item B<trace> [LEVEL]

See Mail::Reporter::trace()

=item B<warnings> 

See Mail::Reporter::warnings()

=back

=head2 Other Methods

=over 4

=item B<AUTOLOAD> 

See Mail::Reporter::AUTOLOAD()

=item B<DESTROY> 

See Mail::Reporter::DESTROY()

=item B<inGlobalDestruction> 

See Mail::Reporter::inGlobalDestruction()

=item B<logPriority> LEVEL

See Mail::Reporter::logPriority()

=item B<logSettings> 

See Mail::Reporter::logSettings()

=item B<notImplemented> 

See Mail::Reporter::notImplemented()

=back

=head1 SEE ALSO

A good start to read is Mail::Box-Overview.
More documentation and a mailinglist are available from the project's
website at L<http://perl.overmeer.net/mailbox/>.

=head1 AUTHOR

Written by Mark Overmeer (L<mark@overmeer.net|mailto:mark@overmeer.net>)
with the help of many.  See the ChangeLog for details.

=head1 VERSION

This code is beta, version 2.037.

Copyright (c) 2001-2003 by the authors. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
