简体   繁体   English

Ruby on Rails:devise不会在sign_up期间将电子邮件发送到邮寄地址

[英]Ruby on Rails: devise doesn't send email to the mailing address during sign_up

During sign_up i entered username, email, password. 在sign_up期间,我输入了用户名,电子邮件,密码。

After clicking the sign_up button, i checked the mail. 单击sign_up按钮后,我检查了邮件。

But i didn't get any email from devise. 但是我没有收到来自devise的电子邮件。

How can i set/configure devise for registration confirmation email ? 如何设置/配置注册确认电子邮件的设计?

Someone please help to fix this problem. 请有人帮助解决此问题。

I have searched in stackoverflow and tried all but failed to solve this problem. 我已经在stackoverflow中进行搜索,并尝试了所有尝试,但均未能解决该问题。

http://0.0.0.0:3000/users/sign_out , i get "Routing error" http://0.0.0.0:3000/users/sign_in , i get "You are already logged in" http://0.0.0.0:3000/users/sign_out ,我得到“路由错误” http://0.0.0.0:3000/users/sign_in ,我得到“您已经登录”

rake routes: 耙路:

        new_user_session GET    /users/sign_in(.:format)       {:action=>"new", :controller=>"devise/sessions"}
            user_session POST   /users/sign_in(.:format)       {:action=>"create", :controller=>"devise/sessions"}
    destroy_user_session DELETE /users/sign_out(.:format)      {:action=>"destroy", :controller=>"devise/sessions"}
           user_password POST   /users/password(.:format)      {:action=>"create", :controller=>"devise/passwords"}
       new_user_password GET    /users/password/new(.:format)  {:action=>"new", :controller=>"devise/passwords"}
      edit_user_password GET    /users/password/edit(.:format) {:action=>"edit", :controller=>"devise/passwords"}
                         PUT    /users/password(.:format)      {:action=>"update", :controller=>"devise/passwords"}
cancel_user_registration GET    /users/cancel(.:format)        {:action=>"cancel", :controller=>"devise/registrations"}
       user_registration POST   /users(.:format)               {:action=>"create", :controller=>"devise/registrations"}
   new_user_registration GET    /users/sign_up(.:format)       {:action=>"new", :controller=>"devise/registrations"}
  edit_user_registration GET    /users/edit(.:format)          {:action=>"edit", :controller=>"devise/registrations"}
                         PUT    /users(.:format)               {:action=>"update", :controller=>"devise/registrations"}
                         DELETE /users(.:format)               {:action=>"destroy", :controller=>"devise/registrations"}
              home_index GET    /home/index(.:format)          {:controller=>"home", :action=>"index"}
                    root        /                              {:controller=>"home", :action=>"index"}

users_controller.rb=> users_controller.rb =>

class UsersController < ApplicationController
  before_filter :authenticate_user!

  def show
    @user = User.find(params[:id])

  end  

end

I did: 我做了:

rails g devise:views

for the email part, check your configuration settings for the mailer. 对于电子邮件部分,请检查邮件程序的配置设置。 can you even send email using actionmailer? 您甚至可以使用actionmailer发送电子邮件吗?

for the second part, with the signout process, the link you're using is calling a GET method. 在第二部分中,通过注销过程,您正在使用的链接将调用GET方法。 As you can see in your routes, to sign out you need a DELETE method in your link which will look like this: 正如您在路线中看到的那样,要注销,您需要在链接中添加一个DELETE方法,该方法如下所示:

<%= link_to "Sign out", destroy_user_session_path, :method => :delete %>

If you want to use GET for sign out specifically, check out the devise initializer file; 如果要专门使用GET进行登出,请签出devise初始化器文件; somewhere at the bottom you'll see something about signing out and the default method being :delete . 在底部的某个地方,您会看到有关注销的信息,默认方法是:delete put this line there: 将此行放在这里:

config.sign_out_via = :get

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

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