Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 主机邮件的sendmail\u设置_Ruby On Rails_Ruby_Ruby On Rails 3_Sendmail_Web Hosting - Fatal编程技术网

Ruby on rails 主机邮件的sendmail\u设置

Ruby on rails 主机邮件的sendmail\u设置,ruby-on-rails,ruby,ruby-on-rails-3,sendmail,web-hosting,Ruby On Rails,Ruby,Ruby On Rails 3,Sendmail,Web Hosting,下午好 我面临着一个问题,那就是如何通过主机上托管的应用程序发送电子邮件 在我的配置/初始值设定项中,我添加了一个包含以下内容的文件“setup\u mailer” ActionMailer::Base.delivery_method = :sendmail ActionMailer::Base.perform_deliveries = true ActionMailer::Base.raise_delivery_errors = true ActionMailer::Base.defa

下午好

我面临着一个问题,那就是如何通过主机上托管的应用程序发送电子邮件

在我的配置/初始值设定项中,我添加了一个包含以下内容的文件“setup\u mailer”

ActionMailer::Base.delivery_method = :sendmail  
ActionMailer::Base.perform_deliveries = true  
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.default_charset = "utf-8"

# Production
if Rails.env.production?
    ActionMailer::Base.sendmail_settings = {
        :location => '/usr/sbin/sendmail',
        :arguments => '-i -t -f support@xxxxx.xxx'
    }
end
我的邮件如下

类通知
def subscription_confirmation(user)
    setup_email(user)
    mail(:to => @recipients, :subject => "blabla")
end

protected

    def setup_email(user)
        @recipients = user.email
        @from = "support@xxxxx.xx"
        headers "Reply-to" => "support@xxxxx.xx"
        @sent_on      = Time.now
        @content_type = "text/html"
    end
结束

在我本地的机器上似乎工作得很好。但在生产过程中,电子邮件发送不正确,我在我的支持收件箱中收到此消息

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.
如果你有任何想法,支持似乎不能帮助我,希望你们中的一些人将有想法或配置文件从主机共享

谢谢,,
albandiguer

尝试在user.email上呼叫用户或将用户电子邮件指定为“#{user.email}”

我遇到了完全相同的问题-通过从sendmail\u设置中删除-t解决了问题

我没有进一步研究其他的影响,但至少它是有效的。但从手册页上看:

   -t     Extract recipients from message headers. These are added to  any
          recipients specified on the command line.

      With Postfix versions prior to 2.1, this option requires that no
      recipient addresses are specified on the command line.

所以可能只是后缀版本的不同?

非常感谢,你是对的,只是删除了设置中的-t。我知道这是一个相当老的问题,但我很想知道你是否发现了关于这个@mmmbacon的任何其他信息