简体   繁体   English

Rails 3,设计,即使设计未设置为可确认,如何发送确认电子邮件?

[英]Rails 3, devise, how can I send the confirmation email even if devise is not set to confirmable?

Maybe this is simple and I haven't figured it out yet, but I want to send the confirmation email that is created when you run the devise views command. 也许这很简单,但我还没有弄清楚,但是我想发送在运行devise views命令时创建的确认电子邮件。

I am running the following model method: 我正在运行以下模型方法:

def send_invitation
     User.find(self).send_confirmation_instructions
   end

but when I run this I get 但是当我运行这个我得到

undefined method `send_confirmation_instructions'

there is a mailer in views/devise/mailer/confirm_instructions.html.erb views / devise / mailer / confirm_instructions.html.erb中有一个邮件程序

Is there a way to send that email without setting users to confirmable? 有没有一种方法可以发送该电子邮件而不将用户设置为可确认?

I don't fully understand the points at which you do/don't want the confirmation feature, but you could include Confirmable but override the methods for the Confirmable features you don't want. 我不完全了解您不希望使用确认功能的要点,但是您可以包括Confirmable,但可以覆盖不需要的确认功能的方法。 Or you could call User.skip_confirmation! 或者您可以致电User.skip_confirmation! after users are created, which automatically "confirms" the user, bypassing Confirmable when you don't want it. 创建用户后,系统会自动“确认”用户,不需要时绕过Confirmable。

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

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