Rails devise does not send confirmation email, but requires

I configure Devise and can create a profile. When I create profiles and try to log in, I get an error that I didnโ€™t confirm my account,

I have never received an email, which I have to confirm with my account. Am I mistaken when choosing this option or didnโ€™t allow Devise to email me?

Here is the migration I used to do this:

class DeviseCreateUsers < ActiveRecord::Migration def self.up create_table(:users, :options => 'ENGINE=InnoDB DEFAULT CHARSET=utf8') do |t| t.database_authenticatable :null => false t.recoverable t.rememberable t.trackable t.confirmable t.encryptable t.column "first_name", :string t.column "last_name", :string t.column "organization_name", :string t.timestamps end add_index :users, :email, :unique => true end def self.down drop_table :users end end 
+7
source share
1 answer

In development mode , you need to add this line to config/environments/development.rb

config.action_mailer.default_url_options = { :host => 'localhost:3000' }

Then check your serverโ€™s logs to see the mail. You should find something like this:

Submitted by devise / mailer / confirm_instructions.html.erb (19.5ms)

Sent mail example@mail.com (21951ms)

Date: Thu May 26, 2011 12:56:55 PM +0200

From: sender@mail.com

Reply to: sender@mail.com

To: example@mail.com

Message-ID: < 4dde31f7944bd_5ac277e0e4785c6@L-Portable.mail >

Subject: confirmation instructions

Mime-Version: 1.0

Content-Type: text / html;

= UTF-8 encoding

 Content-Transfer-Encoding: 7bit <p>Welcome example@mail.com !</p> <p>You can confirm your account through the link below:</p> <p><a href="http://localhost:3000/users/confirmation?confirmation_token=Hi0tyRQU8cCFpAbatYFf">Confirm my account</a></p> 

You also need to put this line in config/initializers/devise.rb

 config.mailer_sender = " sender@mail.com " 

If you REALLY do not have this mail in your logs, you can still confirm your account by taking the confirmation_token value in your database and follow this link

 http://localhost:3000/users/confirmation?confirmation_token= #PUT_YOUR_TOKEN_HERE 

And that should do the trick.

Greetings

+15
source

All Articles