Rails & sendmail recipients with -t option not supported

寵の児 提交于 2019-12-13 02:27:08

问题


I have a development environment file that contains the following

config.action_mailer.delivery_method = :sendmail
config.action_mailer.sendmail_settings = {:arguments => '-i'}

I'm logging into the rails console with that environment loaded up

class MyMailer < ActionMailer::Base
  def test_email
    mail(:to => 'somebodyelse@somewhere.com', 
         :subject => 'test', 
         :from => 'somebody@somewhere.com')
  end
end

MyMailer::test_email.deliver

And instead of getting that email delivered, I get this

sendmail: recipients with -t option not supported

Sendmail is actually not installed on this machine, instead, I've configured SSMTP, following the instructions at http://www.igvita.com/2007/08/29/ssmtp-relay-mail-delivery-in-rails/

I get the same error when I'm sending by :smtp. So it looks to me like either my test is not using the same environment variable or Rails simply ignore the configuration.


回答1:


The environmental loader was being overwritten with other values from /initializers/setup_mail.rb, so ActionMailer::Base would end up using the wrong protocol.



来源:https://stackoverflow.com/questions/6456205/rails-sendmail-recipients-with-t-option-not-supported

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!