diff options
Diffstat (limited to 'lib/net/smtp.rb')
-rw-r--r-- | lib/net/smtp.rb | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb index e6b483252e..271441279a 100644 --- a/lib/net/smtp.rb +++ b/lib/net/smtp.rb @@ -74,6 +74,14 @@ Net::Protocol protocol_param :command_type, '::Net::SMTPCommand' + def initialize( addr = nil, port = nil ) + super + @esmtp = true + end + + + attr :esmtp + def sendmail( mailsrc, fromaddr, toaddrs ) do_ready fromaddr, toaddrs @command.write_mail mailsrc, nil @@ -85,9 +93,6 @@ Net::Protocol end - attr :esmtp - - private @@ -104,10 +109,18 @@ Net::Protocol @esmtp = false begin - @command.ehlo helodom - @esmtp = true + if @esmtp then + @command.ehlo helodom + else + @command.helo helodom + end rescue ProtocolError - @command.helo helodom + if @esmtp then + @esmtp = false + retry + else + raise + end end end |