Ruby アプリがあり、ドキュメントhttp://ruby-doc.org/stdlib-2.0/libdoc/net/smtp/rdoc/Net/SMTP.htmlにあるこの形式のメールを送信しています。
Net::SMTP.start('your.smtp.server', 25) do |smtp|
smtp.send_message msgstr, 'from@address', 'to@address'
end
これは私のコードです:
def send_notification(exception)
msgstr = <<-END_OF_MESSAGE
From: Exchange Errors <exchangeerrors@5112.mysite.com>
To: Edmund Mai <emai@mysite.com>
Subject: test message
Date: Sat, 23 Jun 2001 16:26:43 +0900
Message-Id: <unique.message.id.string@mysite.com>
This is a test message.
END_OF_MESSAGE
Net::SMTP.start('localhost', 25) do |smtp|
smtp.send_message(msgstr, "exchangeerrors@5112.mysite.com", "emai@mysite.com")
end
end
ただし、送信されるメールには件名がありません。msgstr
がそのままメール本文になります。メールの件名を指定する方法に関するドキュメントのどこにもありません。誰か知っていますか?