From: Russell Fulton Date: 2006-10-11T09:56:38+09:00 Subject: recovering from errors in net:smtp Hi, I've got a script that sends reports by email using Net::SMTP. Occassionally I get errors from the mail server (normally rejected addresses) which causes an exception which I catch with rescue. This is in a class derived from Net::SMTP: def send (to, subject, data) retries = 0 @count += 1 to_array = to.split(/\s*,\s*/) hdrs = < From: #{@from} HDRS send_message( hdrs + data.join("\n") + ".\n", @from, *to_array) rescue Net::SMTPFatalError, Net::SMTPSyntaxError if $! =~ /virtual alias table/ then retries += 1 STDERR.puts "mail failed #{retries} for #{to}:#{$!}" spleep(10) retry if retries <= 2 end STDERR.puts "mail failed for #{to}:#{$!}" false end I wish to 'reset' the smtp session so that I can continue sending email without doing a finish and another start (i.e. before I retry). Is this possible? I've looked through the docs for net::smtp and not found anything obvious. I have not looked at the source yet. Russell -- Posted via http://www.ruby-forum.com/.