Actionmailer如何工作? [英] How does Actionmailer work?

查看:77
本文介绍了Actionmailer如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我需要给2个人发送一封信,该怎么办?我在网络上找到了文档,但是我听不懂,您可以使用简单的语言向我展示并向我解释吗?

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

在这里,我已调用方法send_mail_persons并将接收者信息作为参数传递还有一种简单的方法。

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

并在常量中定义MAILING_ADDRESS和MAIL_ADDRESS。

and define both MAILING_ADDRESS and MAIL_ADDRESS in the constants.

感谢

这篇关于Actionmailer如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆