views:

71

answers:

1

Hello, in my ActionMailer config file I have this:

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
  :address => "mail.foo.com",
  :port => 25,
  :domain => "foo.com",
  :authentication => :email,
  :user_name => "[email protected]",
  :password => "foo1234567"
}

With this configuration can I only send out email from the [email protected] email address? If so is there a way to send out emails from other addresses? I have this in my ActionMailer class:

class Notifications < ActionMailer::Base

  def answered_question(faq)
    subject       'Your question has been answered'
    recipients    faq.email
    from          'Foo <[email protected]>'
    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 <[email protected]>'
    sent_on        Time.now
    content_type   "text/html"
    body           :order => order
  end
end

In development everything works out fine but in production the completed_order emails are not being sent out.

Thanks.

A: 

I would guess that this is more of a SMTP issue that it is ActionMailer. Some SMTP's do not require Username/Passwords to send outgoing mail and so you can set the From address as you like.

That said, since you're experiencing issues sending out messages that have a From address different from what you're using to authenticate to your SMTP server, I'd guess there's a restriction on the SMTP box that only allows messages to be sent if the From address matches the authenticating UID.

Scott
Yeah it turned out to be a server configuration problem. Thanks!
vrish88