From: "aktxyz@..." Date: 2008-01-30T10:49:57+09:00 Subject: Re: smtp.set_debug_output - capture output to string? On Jan 29, 7:31 pm, "akt...@gmail.com" wrote: > As shown below, I can send debug output from Net::SMTP to stderr, how > to I send this to a string instead? > > smtp = Net::SMTP.new(x[:address], x[:port]) > smtp.set_debug_output $stderr > smtp.start(x[:domain], x[:user_name], x[:password], > x[:authentication]) do |smtp| > smtp.sendmail(mail.encoded, mail.from, mail.destinations) > end fyi, this StringIO technique does not work... smtp = Net::SMTP.new(x[:address], x[:port]) s = StringIO.new smtp.set_debug_output s smtp.start(x[:domain], x[:user_name], x[:password], x[:authentication]) do |smtp| smtp.sendmail(mail.encoded, mail.from, mail.destinations) end s.rewind pp s.readlines