Index: modules/mime/smtp.man ================================================================== --- modules/mime/smtp.man +++ modules/mime/smtp.man @@ -1,7 +1,8 @@ [comment {-*- tcl -*- doctools manpage}] -[manpage_begin smtp n 1.4.5] +[vset VERSION 1.4.6] +[manpage_begin smtp n [vset VERSION]] [see_also ftp] [see_also http] [see_also mime] [see_also pop3] [copyright {1999-2000 Marshall T. Rose and others}] @@ -8,11 +9,11 @@ [moddesc {smtp client}] [titledesc {Client-side tcl implementation of the smtp protocol}] [category Networking] [require Tcl] [require mime [opt 1.5.4]] -[require smtp [opt 1.4.5]] +[require smtp [opt [vset VERSION]]] [description] [para] The [package smtp] library package provides the client side of the Simple Mail Transfer Protocol (SMTP) (1) (2). @@ -29,13 +30,23 @@ [def [option -servers]] A list of SMTP servers. The default is [const localhost]. +[para] If multiple servers are specified they are tried in sequence. + +Note that the [option -ports] are iterated over in tandem with the +servers. If there are not enough ports for the number of servers the +default port (see below) is used. If there are more ports than servers +the superfluous ports are ignored. + [def [option -ports]] A list of SMTP ports. The default is [const 25]. + +[para] See option [option -servers] above regardig the behaviour for +then multiple servers and ports are specified. [def [option -client]] The name to use as our hostname when connecting to the server. By default this is either localhost if one of the servers is localhost, Index: modules/mime/smtp.tcl ================================================================== --- modules/mime/smtp.tcl +++ modules/mime/smtp.tcl @@ -621,18 +621,16 @@ set state(options) [array get options] # Iterate through servers until one accepts a connection (and responds # nicely). - set index 0 - foreach server $options(-servers) { + foreach server $options(-servers) port $options(-ports) { + if {$server == ""} continue + set state(readable) 0 - if {[llength $options(-ports)] >= $index} { - set port [lindex $options(-ports) $index] - } else { - set port 25 - } + if {$port == ""} { set port 25 } + if {$options(-debug)} { puts stderr "Trying $server..." flush stderr } @@ -672,11 +670,10 @@ set r [initialize_ehlo $token] if {$r != {}} { return $r } - incr index } # None of the servers accepted our connection, so close everything up and # return an error. finalize $token -close drop @@ -1498,11 +1495,11 @@ } } # ------------------------------------------------------------------------- -package provide smtp 1.4.5 +package provide smtp 1.4.6 # ------------------------------------------------------------------------- # Local variables: # indent-tabs-mode: nil # End: