diff options
author | Graham Barr <gbarr@pobox.com> | 2003-05-20 11:45:59 +0000 |
---|---|---|
committer | Graham Barr <gbarr@pobox.com> | 2003-05-20 11:45:59 +0000 |
commit | 6f70ad0c06dd345c397a7a650baf686e374e5a9f (patch) | |
tree | c2c36d83304a1c6b1c752755d6dd617b3e3e7466 | |
parent | 1c06f77a10dc580e580a10e776a2b986e5eab5e2 (diff) | |
download | perl-libnet-6f70ad0c06dd345c397a7a650baf686e374e5a9f.tar.gz |
Net::SMTP
- Allow multiple hosts to be passed to new() as an array reference
-rw-r--r-- | Net/SMTP.pm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Net/SMTP.pm b/Net/SMTP.pm index 1609ac8..be64037 100644 --- a/Net/SMTP.pm +++ b/Net/SMTP.pm @@ -16,7 +16,7 @@ use IO::Socket; use Net::Cmd; use Net::Config; -$VERSION = "2.26"; # $Id: //depot/libnet/Net/SMTP.pm#30 $ +$VERSION = "2.26"; # $Id: //depot/libnet/Net/SMTP.pm#31 $ @ISA = qw(Net::Cmd IO::Socket::INET); @@ -26,11 +26,11 @@ sub new my $type = ref($self) || $self; my $host = shift if @_ % 2; my %arg = @_; - my $hosts = defined $host ? [ $host ] : $NetConfig{smtp_hosts}; + my $hosts = defined $host ? $host : $NetConfig{smtp_hosts}; my $obj; my $h; - foreach $h (@{$hosts}) + foreach $h (@{ref($hosts) ? $hosts : [ $hosts ]}) { $obj = $type->SUPER::new(PeerAddr => ($host = $h), PeerPort => $arg{Port} || 'smtp(25)', @@ -570,6 +570,9 @@ known as mailhost: This is the constructor for a new Net::SMTP object. C<HOST> is the name of the remote host to which an SMTP connection is required. +If C<HOST> is an array reference then each value will be attempted +in turn until a connection is made. + If C<HOST> is not given, then the C<SMTP_Host> specified in C<Net::Config> will be used. @@ -762,6 +765,6 @@ it under the same terms as Perl itself. =for html <hr> -I<$Id: //depot/libnet/Net/SMTP.pm#30 $> +I<$Id: //depot/libnet/Net/SMTP.pm#31 $> =cut |