Ruby 初心者スレッド Part 41
■ このスレッドは過去ログ倉庫に格納されています
0648デフォルトの名無しさん
2011/04/01(金) 17:08:18.64#!/Ruby/bin/ruby.exe
# -*- coding: utf-8 -*-.
from = "[email protected]"
to = "[email protected]"
mail_body = <<EOM
Date: Fri, 1 Apr 2011 10:03:27 +0900
From: #{from}
To: #{to}
Subject: test title
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-2022-jp
test body
EOM
@error = []
begin
require "net/smtp"
Net::SMTP.start("foo.bar.jp", 25, "localhost.localdomain", user, pass, "login"){|smtp|
smtp.send_mail(mail_body, from, to)
}
rescue Exception => ex
File.open('smp_error.txt', 'w'){|f| f.puts ex.backtrace }
@error << ex.backtrace
end
print "HTTP/1.1 200 OK\n"
print "Content-Type: text/plain\n\n"
puts @error
■ このスレッドは過去ログ倉庫に格納されています