Can you email only the username specified in the ActionMailer smmp_settings file?
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 => "no-reply@foo.com",
:password => "foo1234567"
}
With this configuration, can I only send email from an email address no-reply@foo.com
? Is there a way to send 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 <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
In development, everything works fine, but during production, emails are completed_order
not sent.
Thanks.
source to share
I would guess this is more of an SMTP problem than an ActionMailer. Some SMTPs do not require a username / password to send outgoing mail, so you can set the From address as you like.
However, since you are experiencing problems sending messages that have a different From address than what you are using to authenticate to your SMTP server, I would assume there is a limitation on the SMTP field that only allows messages to be sent if From address matches the authentication ID.
source to share