Rails 请教 Action Mailer 到底能不能设置发件人的 email 地址

qqerqqer · May 19, 2012 · Last by qqerqqer replied at May 19, 2012 · 4800 hits

下面是我的 Notifer 的代码,其中@email包含收件人,发件人,邮件主题等信息: class Notifier < ActionMailer::Base default :from => "[email protected]"

def email(email) @email = email mail(:from => @email.sender, :to => @email.reciever, :cc => @email.sender, :subject => @email.title)
end end 根据官方的文档添加 from 就可以设置发件人的地址,可是不成功。怎么办啊。求 DX~~~

当然是可以,只是方法不对而已

还有就是代码请用三个反引号 ``` 包括起来,并适当缩进

#1 楼 @willmouse 求深入~~~

#3 楼 @diudiutang 按照你的方法成功了,thx~~~

You need to Sign in before reply, if you don't have an account, please Sign up first.