我有一个 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
只是成为电子邮件的正文。我在文档中没有看到有关如何指定邮件主题的任何地方。有人知道吗?