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::SMTP - transmit messages without external program

CLASS HIERARCHY

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

SYNOPSIS

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

 $message->send(via => 'smtp');

DESCRIPTION

This module implements transport of Mail::Message objects by negotiating to the destination host directly by using the SMTP protocol, without help of sendmail, mail, or other programs on the local host.

METHOD INDEX

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

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

      contactAnyServer                 MTS send MESSAGE, OPTIONS
   MR errors                            MR trace [LEVEL]
   MR log [LEVEL [,STRINGS]]               tryConnectTo HOST, OPTIONS
      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...   MTS putContent MESSAGE, FILEHAN...
   MR inGlobalDestruction               MT remoteHost
   MR logPriority LEVEL                 MT retry

METHODS

new OPTIONS
 OPTION      DESCRIBED IN           DEFAULT
 debug       Mail::Transport::SMTP  0
 helo_domain Mail::Transport::SMTP  <from Net::Config>
 hostname    Mail::Transport        <from Net::Config>
 interval    Mail::Transport        30
 log         Mail::Reporter         'WARNINGS'
 password    Mail::Transport        <not used>
 proxy       Mail::Transport::STMP  <from Net::Config>
 retry       Mail::Transport        undef
 timeout     Mail::Transport::SMTP  120
 trace       Mail::Reporter         'WARNINGS'
 username    Mail::Transport        <not used>
 via         Mail::Transport        'smtp'
debug => BOOLEAN

Simulate transmission: the SMTP protocol output will be sent to your screen.

helo_domain => HOST

The fully qualified name of the sender's host (your system) which is used for the greeting message to the receiver. If not specified, Net::Config or else Net::Domain are questioned to find it. When even these do not supply a valid name, the name of the domain in the From line of the message is assumed.

timeout => SECONDS

The number of seconds to wait for a valid response from the server before failing.

trySend MESSAGE, OPTIONS

Try to send the MESSAGE once. This may fail, in which case this method will return false. In list context, the reason for failure can be caught: in list context trySend will return a list of five values:

 (success, error code, error text, error location, quit success)

Success and quit success are booleans. The error code and -text are protocol specific codes and texts. The location tells where the problem occurred.

As OPTIONS, you can use

  • to => ADDRESS|[ADDRESSES]

    Alternative destinations. If not specified, the To, Cc and Bcc fields of the header are used. An address is a string or a Mail::Address object.

  • from => ADDRESS

    Your own identification. This may be fake. If not specified, it is taken from the From field in the header.

contactAnyServer

Creates the connection to the SMTP server. When more than one hostname was specified, the first which accepts a connection is taken. An IO::Server::INET object is returned.

tryConnectTo HOST, OPTIONS

Try to establish a connection to deliver SMTP to the specified HOST. The OPTIONS are passed to the new method of Net::SMTP.

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.