简体   繁体   English

在设计用户创建时发送自定义电子邮件

[英]Sending custom email message on devise user creation

So I need to send a confirmation email every time a user signs up. 因此,我需要在每次用户注册时发送一封确认电子邮件。 There are two ways of signing up -- either when a user hits my login page, or when he is invited by another user. 两种注册方式-一种是用户点击我的登录页面时,另一种是他邀请时。 In both cases, I want to send separate types of email (in the second case, I also want to tell them that you were sent invitation by foo@bar.com person etc.). 在这两种情况下,我都希望发送不同类型的电子邮件(在第二种情况下,我还想告诉他们foo@bar.com人员等向您发送了邀请。) What is the best way to do this? 做这个的最好方式是什么? I am using devise for rails. 我正在使用devise for rails。

use action mailer for sending email 使用动作邮件发送邮件

you can send email by using callback means that if you user sign up then below method call 您可以使用回调发送电子邮件,这意味着如果用户注册,则可以使用以下方法调用

after_create :send_mail_to_xxx_xxx
def send_mail_to_xxx_xxx 
  ... 
  ...
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM