开发者

How does Actionmailer work?

If I need send some letter to 2 people, how can I do this? I found docs in web, but I don't understand them, can开发者_开发百科 you show me and explain me using simple language?


def send_mail_persons(user)
  @user = user
  mail :to => @user.email, :subject => "Amusement.", :from => MAIL_ADDRESS
end

Here i have called the method send_mail_persons and passed the recipients info as a parameter.Also there is a simple way..

def send_mail_persons
  mail :to => MAILING_ADDRESS, :subject => "Amusement.", :from => MAIL_ADDRESS
end

and define both MAILING_ADDRESS and MAIL_ADDRESS in the constants.

Thanx


Best you can find is Ryan's Railscast:

http://railscasts.com/episodes/206-action-mailer-in-rails-3

Also good guide is here:

http://guides.rubyonrails.org/action_mailer_basics.html

Actually you can read there not just about ActionMailer but about whole Rails kitchen.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜