NAME
Mail::Transport::SMTP - transmit messages without external program
CLASS INHERITANCE
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.
METHODS
Initiation
- new OPTIONS
-
OPTION DEFAULT debug <false> helo_domain <from Net::Config> hostname <from Net::Config> interval 30 log 'WARNINGS' password undef port 25 proxy <from Net::Config> retry <false> timeout 120 trace 'WARNINGS' username undef via '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. - hostname => HOSTNAME|ARRAY-OF-HOSTNAMES
-
See Mail::Transport::new(hostname)
- interval => SECONDS
-
See Mail::Transport::new(interval)
- log => LEVEL
-
See Mail::Reporter::new(log)
- password => STRING
-
The password to be used with the new(username) to log in to the remote server.
- port => INTEGER
-
See Mail::Transport::new(port)
- proxy => PATH
-
See Mail::Transport::new(proxy)
- retry => NUMBER|undef
-
See Mail::Transport::new(retry)
- timeout => SECONDS
-
The number of seconds to wait for a valid response from the server before failing.
- trace => LEVEL
-
See Mail::Reporter::new(trace)
- username => STRING
-
Use SASL authentication to contact the remote SMTP server (RFC2554). This username in combination with new(password) is passed as arguments to Net::SMTP::auth(). Other forms of authentication are not supported by Net::SMTP. The
username
can also be specified as an Authen::SASL object. - via => CLASS|NAME
-
See Mail::Transport::new(via)
Server Connection
- findBinary NAME [, DIRECTORIES]
-
See Mail::Transport::findBinary()
- remoteHost
-
See Mail::Transport::remoteHost()
- retry
-
See Mail::Transport::retry()
Sending Mail
- 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::Socket::INET object is returned.
- destinations MESSAGE, [ADDRESS|ARRAY-OF-ADDRESSES]
-
Determine the destination for this message. If a valid ADDRESS is defined, this is used to overrule the addresses within the message. If the ADDRESS is
undef
it is ignored.If no ADDRESS is specified, the message is scanned for resent groups (see Mail::Message::Head::resentGroups()). The addresses found in the first (is latest added) group are used. If no resent groups are found, the normal
To
,Cc
, andBcc
lines are taken. - putContent MESSAGE, FILEHANDLE, OPTIONS
-
See Mail::Transport::Send::putContent()
- send MESSAGE, OPTIONS
-
See Mail::Transport::Send::send()
- 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. - 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 contexttrySend
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.
OPTION DEFAULT from [] to []
Logging and Tracing
- defaultTrace [LEVEL, [LEVEL]
-
See Mail::Reporter::defaultTrace()
- errors
-
See Mail::Reporter::errors()
- log [LEVEL [,STRINGS]]
-
See Mail::Reporter::log()
- report [LEVEL]
-
See Mail::Reporter::report()
- reportAll [LEVEL]
-
See Mail::Reporter::reportAll()
- trace [LEVEL]
-
See Mail::Reporter::trace()
- warnings
-
See Mail::Reporter::warnings()
Other Methods
- AUTOLOAD
-
See Mail::Reporter::AUTOLOAD()
- DESTROY
-
See Mail::Reporter::DESTROY()
- inGlobalDestruction
-
See Mail::Reporter::inGlobalDestruction()
- logPriority LEVEL
-
See Mail::Reporter::logPriority()
- logSettings
-
See Mail::Reporter::logSettings()
- notImplemented
-
See Mail::Reporter::notImplemented()
SEE ALSO
A good start to read is Mail::Box-Overview. More documentation and a mailinglist are available from the project's website at http://perl.overmeer.net/mailbox/.
AUTHOR
Written by Mark Overmeer (mark@overmeer.net) with the help of many. See the ChangeLog for details.
VERSION
This code is beta, version 2.031.
Copyright (c) 2001-2002 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.