我无法弄清楚为什么@delivery_options
无法从各个邮件程序方法中访问实例变量...
class UserMailer < ActionMailer::Base
@delivery_options = {
user_name: 'foo',
password: 'bar',
address: 'smtp.foobar.net'
}
def invite_email (email, project)
logger.debug( @delivery_options ) #WHY IS THIS IS UNDEFINED??
@project = project
#THIS WORKS FINE
mail(to: email, subject: "WORK DAMMIT", delivery_method_options: {
user_name: 'foo',
password: 'bar',
address: 'smtp.foobar.net'
})
#THIS FAILS
#mail(to: email, subject: "WORK DAMMIT", delivery_method_options: @delivery_options)
end
end