ruby-on-rails - ActionMailer 传递命令返回什么?

标签 ruby-on-rails actionmailer

我正在尝试找出如何优雅地通知用户 Rails 尚未发送电子邮件。

问题是这行代码:

OrderNotifier.received(@order).deliver

当 smtp 服务器不响应传送命令时会发生什么(例如,smtp 服务器已关闭)。我见过这样的示例代码:

@response_from_deliver = OrderNotifier.received(@order).deliver

但找不到任何文档表明这是一个有效的分配,或者如果是的话,来自 ActionMailer 的各种响应可能会是什么。

感谢您提供任何信息。

最佳答案

您将返回 Mail::Message 对象类型。 Apidock.com 看起来有一些 good information on ActionMailer

#<Mail::Message:70225058423980, 
Multipart: false, Headers: <Date: Mon, 20 Jan 2014 12:06:05 -0600>, 
<From: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fa93949c95ba899599939b96889f898ed4979f" rel="noreferrer noopener nofollow">[email protected]</a>>, 
<To: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7815011d15191114381f15191114561b1715" rel="noreferrer noopener nofollow">[email protected]</a>>, 
<Message-ID: <<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d1e4e3b5b5e7e4e9b5e9b7e1b7e68ee0e0e7e5e2b7b5b4e9b5e3e0e8e0e7e1e3e2e4b4e591b89cb0b2ffbdbeb2b0bdffbcb0b8bd" rel="noreferrer noopener nofollow">[email protected]</a>>>, 
<Subject: Welcome to My Site>, 
<Mime-Version: 1.0>, 
<Content-Type: text/html>, 
<Content-Transfer-Encoding: quoted-printable>>

关于ruby-on-rails - ActionMailer 传递命令返回什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15978431/

相关文章:

ruby-on-rails - Rails 4 嵌套表单 Simple_form_for 和 simple_field_for

mysql - 对 ActiveRecord setter/getter 方法使用 mysql 函数

ruby - ActionMailer 不在 Rails 3.1.1 中发送邮件

ruby-on-rails - Rails ActionMailer TSL 插件 - 发件人电子邮件问题

ruby-on-rails - Heroku上的Rails ActionMailer拦截器

ruby-on-rails - Rails - URL 助手在邮件程序中不起作用

ruby-on-rails - 使用 Paperclip 解析电子邮件附件 - 可能没有临时文件?

ruby-on-rails - rails - Elasticsearch 完成建议器和搜索 API

mysql - ruby rails : Find the record with lowest value of a specific column

ruby-on-rails - Heroku帮助权限被拒绝如何打开文件?