Actionmailer如何运作?
如果我需要给2个人发一封信,我怎么能这样做? 我在网上找到了文档,但我不理解它们,你能告诉我并用简单的语言解释我吗?
def send_mail_persons(user) @user = user mail :to => @user.email, :subject => "Amusement.", :from => MAIL_ADDRESS end
在这里,我调用了方法send_mail_persons并将收件人信息作为参数传递。还有一种简单的方法..
def send_mail_persons mail :to => MAILING_ADDRESS, :subject => "Amusement.", :from => MAIL_ADDRESS end
并在常量中定义MAILING_ADDRESS和MAIL_ADDRESS。
感谢名单
你能找到的最好的是Ryan的Railscast:
http://railscasts.com/episodes/206-action-mailer-in-rails-3
这里还有很好的指南:
http://guides.rubyonrails.org/action_mailer_basics.html
实际上你不仅可以阅读ActionMailer,还可以阅读整个Rails厨房。