在我的 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
中没有发送电子邮件。
谢谢。