使用
rails s
我可以在日志输出中看到整个已发送的电子邮件,但使用 rails c
和 Notification.the_mail().deliver
我只看到一长串显示标题:
=> #<Mail::Message:70159541028200, Multipart: true, Headers: <Date: Fri, 06 Dec 2013 15:43:59 +0100>, <From: TestTitle <[email protected]>>, <Message-ID: <[email protected]>>, <Subject: TestSubject>, <Mime-Version: 1.0>, <Content-Type: multipart/alternative; boundary="--==_mimepart_52a1e2af4b1c4_c11c3fcf4a034ec854530"; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>>
尸体在哪里??
Rails.logger.info
输出也被 rails c
省略...
如何获得完整的日志输出?我尝试了从 0-5 的所有日志级别...
在开发环境的 Rails 控制台中,您只会看到记录到 stdout 的返回值,如上所示。
如果您想查找消息正文,您需要查看 Rails 日志文件,该文件应该位于您项目中的
log/development.log
。
我知道OP的情况并非如此,但我从谷歌来到这里,我希望我之后的人确保他们不会犯我犯过的同样错误。
就我而言,我忘记在末尾添加
.deliver
调用:/
# Wrong
Notification.the_mail()
# Right
Notification.the_mail().deliver