开发者

How does Actionmailer work?

开发者 https://www.devze.com 2023-02-20 14:22 出处:网络
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(

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

精彩评论

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