Devise - 手动注册时不同的电子邮件 [英] Devise - Different email when manually registered

查看:115
本文介绍了Devise - 手动注册时不同的电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想给管理员手动注册新用户的功能。

I want to give the administrator the ability to manually register new users.

只要在管理员操作中创建一个新用户,我想发送一切就行了

Everything goes fine by just creating a new user in the admin action but I want to send a different email to these users than the one being sent to those who registered following the normal procedure.

任何想法?

推荐答案

我想您可以在管理员操作中跳过发送原始确认邮件。简单地创建自己的邮件程序并发送所需的邮件。

I think you can skip sending the original confirmation mail in your admin action. Simple create your own mailer action and send your desired mail.

也许也可以创建一个正常的确认邮件,但修改邮件输出。

Maybe it is also possible to create a normal confirmation mail, but modify the mail output.

bundle exec rails generate devise:views

之后修改app / views / devise / mailer / confirmation_instructions.html.erb中的文本

And after that modify the text in "app/views/devise/mailer/confirmation_instructions.html.erb

<% if @sent_by_admin == true %>
  ...admin mailer text...
<% else %>
  ...normal mailer text...
<% end %>

@sent_by_admin可以是一个帮助变量,它被传递给设计确认邮件。

@sent_by_admin could be a helper variable, which is passed to the devise confirmation mailer.

这篇关于Devise - 手动注册时不同的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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