質問

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.

Any ideas?

役に立ちましたか?

解決

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

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 could be a helper variable, which is passed to the devise confirmation mailer.

他のヒント

I expect you would need to follow the instructions on the [devise page to generate the controllers and then modify your create action to generate the additional email.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top