调试 Actionmailer
我已经设置了actionmailer。电子邮件未发送,也没有错误。
我可以从哪里开始搜索来调试这个?
class Notifier < ActionMailer::Base
default_url_options[:host] = APP_DOMAIN
def email_blast(user, subject, message)
subject subject
from NOTIFIER_EMAIL
recipients user.email
sent_on Time.zone.now
body :user => user.first_name + ' ' + user.last_name, :message => message
end
我确实在日志中收到了电子邮件已发送的返回信息,但没有实际的电子邮件通过。
这不起作用的另一个原因是我从集群切换到单独的盒子,并且一些服务器设置被覆盖。我怀疑这可能是这不起作用的原因。有人知道我需要查看哪些具体的服务器设置吗?
更新:
ActionMailer::Base.delivery_method = :sendmail
config.action_mailer.default_url_options = { :host => "75.101.153.93" }
我在我的 production.rb 中找到了这个。这段代码最初工作时就在这里。再次,我相信我的服务器上一定缺少一些东西。我做了一个“which sendmail”,它返回了 /usr/bin/sendmail ,所以我添加了这个:
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_deliveries = true
config.action_mailer.sendmail_settings = {
:location => '/usr/bin/sendmail',
:arguments => '-i -t'
}
重新部署,重新启动服务器,并测试它。没有发送任何电子邮件。
Production.log 表示已发送一些内容:
Processing MediaController#create_a_video (for 173.161.167.41 at 2010-06-03 11:58:13) [GET]
Parameters: {"action"=>"create_a_video", "controller"=>"media", "organization_id"=>"470", "_"=>"1275591493194"}
Sent mail to [email protected]
Rendering media/create_a_video
Completed in 128ms (View: 51, DB: 1) | 200 OK [http://invent.hqchannel.com/organizations/470/media/create_a_video?_=1275591493194]
I have actionmailer set up. Emails are not being sent, and no errors.
Where can I start my search to debug this?
class Notifier < ActionMailer::Base
default_url_options[:host] = APP_DOMAIN
def email_blast(user, subject, message)
subject subject
from NOTIFIER_EMAIL
recipients user.email
sent_on Time.zone.now
body :user => user.first_name + ' ' + user.last_name, :message => message
end
I do get a return in my log that the email was sent, just no actual email goes through.
Also the reason, that this is not working is because I switched form a cluster to a solo box and some server settings were overwritten. I suspect that is probably the reason why this is not working. Anyone know what specific server settings I would have to look at ?
UPDATE:
ActionMailer::Base.delivery_method = :sendmail
config.action_mailer.default_url_options = { :host => "75.101.153.93" }
I found this in my production.rb . This code was originally here when it worked. Again, I believe that there must be something missing on my server..I did a 'which sendmail' and it returned /usr/bin/sendmail , so I added this :
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_deliveries = true
config.action_mailer.sendmail_settings = {
:location => '/usr/bin/sendmail',
:arguments => '-i -t'
}
Redeployed, restarted the server, and tested it. No emails were sent.
The production.log said something was sent :
Processing MediaController#create_a_video (for 173.161.167.41 at 2010-06-03 11:58:13) [GET]
Parameters: {"action"=>"create_a_video", "controller"=>"media", "organization_id"=>"470", "_"=>"1275591493194"}
Sent mail to [email protected]
Rendering media/create_a_video
Completed in 128ms (View: 51, DB: 1) | 200 OK [http://invent.hqchannel.com/organizations/470/media/create_a_video?_=1275591493194]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论