The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Mail::Transport::Send - send a message

CLASS HIERARCHY

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

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);

DESCRIPTION

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

  • Mail::Transport::Sendmail

    Use sendmail to process and deliver the mail. This requires the sendmail program to be installed on your system.

  • Mail::Transport::Qmail

    Use qmail-inject to distribute the message.

  • 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).

  • Mail::Transport::Mailx

    Use the external mail, mailx, or Mail programs to send the message. Usually, the result is poor, because some versions of these programs do not support MIME headers.

METHOD INDEX

Methods prefixed with an abbreviation are described in Mail::Reporter (MR), Mail::Transport (MT).

The general methods for Mail::Transport::Send objects:

   MR errors                               send MESSAGE, OPTIONS
   MR log [LEVEL [,STRINGS]]            MR trace [LEVEL]
      new OPTIONS                          trySend MESSAGE, OPTIONS
   MR report [LEVEL]                    MR warnings
   MR reportAll [LEVEL]

The extra methods for extension writers:

   MR AUTOLOAD                          MR logSettings
   MR DESTROY                           MR notImplemented
   MT findBinary NAME [, DIRECTOR...       putContent MESSAGE, FILEHAN...
   MR inGlobalDestruction               MT remoteHost
   MR logPriority LEVEL                 MT retry

METHODS

new OPTIONS
 OPTION            DESCRIBED IN       DEFAULT
 hostname          Mail::Transport    'localhost'
 interval          Mail::Transport    30
 log               Mail::Reporter     'WARNINGS'
 password          Mail::Transport    undef
 proxy             Mail::Transport    undef
 retry             Mail::Transport    undef
 timeout           Mail::Transport    120
 trace             Mail::Reporter     'WARNINGS'
 username          Mail::Transport    undef
 via               Mail::Transport    'sendmail'
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 succesfully completed.

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

trySend MESSAGE, OPTIONS

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

METHODS for extension writers

putContent MESSAGE, FILEHANDLE, OPTIONS

Print the content of the MESSAGE to the FILEHANDLE.

 OPTIONS           DESCRIBED IN         DEFAULT
 body_only         Mail::Transport      <false>
 undisclosed       Mail::Transport      <false>
  • body_only => BOOLEAN

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

  • undisclosed => BOOLEAN

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

SEE ALSO

Mail::Box-Overview

For support and additional documentation, see http://perl.overmeer.net/mailbox/

AUTHOR

Mark Overmeer (mailbox@overmeer.net). All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

VERSION

This code is beta, version 2.018.

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