1

私のActionMailer設定ファイルにはこれがあります:

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
  :address => "mail.foo.com",
  :port => 25,
  :domain => "foo.com",
  :authentication => :email,
  :user_name => "no-reply@foo.com",
  :password => "foo1234567"
}

この構成では、no-reply@foo.comメールアドレスからのみメールを送信できますか?もしそうなら、他のアドレスからメールを送信する方法はありますか?ActionMailerクラスにこれがあります:

class Notifications < ActionMailer::Base

  def answered_question(faq)
    subject       'Your question has been answered'
    recipients    faq.email
    from          'Foo <no-reply@foo.com>'
    sent_on       Time.now
    content_type  "text/html"
    body          :faq => faq
  end


  def completed_order(order)
    subject        'Your order has been completed'
    recipients     order.email                                       
    from           'Foo <registrations@foo.com>'
    sent_on        Time.now
    content_type   "text/html"
    body           :order => order
  end
end

開発ではすべてが正常に機能しますが、本番completed_order環境では電子メールは送信されません。

ありがとう。

4

1 に答える 1

0

これは、ActionMailer であるというより SMTP の問題であると思います。一部の SMTP は、送信メールを送信するためにユーザー名/パスワードを必要としないため、差出人アドレスを好きなように設定できます。

とはいえ、SMTP サーバーへの認証に使用しているものとは異なる送信者アドレスを持つメッセージを送信する際に問題が発生しているため、SMTP ボックスには、次の場合にのみメッセージの送信を許可する制限があると思います。 From アドレスは認証 UID と一致します。

于 2009-05-06T20:20:59.887 に答える