nei*_*mad 1 ruby-on-rails actionmailer ruby-on-rails-3
我的prod actionmailer有问题.我托管在site5共享云上.问题是我收到此错误消息.
A message that you sent using the -t command line option contained no
addresses that were not also on the command line, and were therefore
suppressed. This left no recipient addresses, and so no delivery could
be attempted.
------ This is a copy of your message, including all the headers. ------
Date: Sat, 17 Sep 2011 21:06:42 +0000
From: noreply@mydomain.com
To: myemail@mydomain.com
Message-ID: <4e750be27b3ef_4a9c159402ee91b039763@themailserver.com>
Subject: test
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
Run Code Online (Sandbox Code Playgroud)
我添加了默认值
default :recipient => 'noreply@mydomain.com'
Run Code Online (Sandbox Code Playgroud)
但邮件给我的错误也是一样的.
我的ActionMailer控制器
class Emailtousers < ActionMailer::Base
default :from => "noreply@mydomain.com"
default :recipient => "noreplay@mydomain.com"
def plan_notification(resource)
@resource = resource
puts resource
mail(:to => "myemail@mydomain.com", :subject => 'test')
end
end
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
我跟着这个来帮助我http://edgeguides.rubyonrails.org/action_mailer_basics.html
我使用exim的sendmail传递方法得到了这个问题.将此添加到config/application.rb为我修复它:
config.action_mailer.sendmail_settings = { :arguments => "-i" }
Run Code Online (Sandbox Code Playgroud)
我在https://github.com/mikel/mail/issues/70#issuecomment-2639987找到了解决方案