简体   繁体   中英

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

During sign_up i entered username, email, password.

After clicking the sign_up button, i checked the mail.

But i didn't get any email from 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.

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"

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=>

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?

for the second part, with the signout process, the link you're using is calling a GET method. As you can see in your routes, to sign out you need a DELETE method in your link which will look like this:

<%= 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; somewhere at the bottom you'll see something about signing out and the default method being :delete . put this line there:

config.sign_out_via = :get

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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