Devise, no E-Mails

2019-07-28 13:16发布

问题:

I installed devise.

I run rails server -e development and set this line in config/environments:

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

Devises says:

 message with a confirmation link has been sent to your email address. Please open the      link to activate your account.

But I didn't receive any mail.

What do you think?

回答1:

Add these lines to your development.rb file

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :domain               => 'baci.lindsaar.net',
  :user_name            => '<username>',
  :password             => '<password>',
  :authentication       => 'plain',
  :enable_starttls_auto => true  }

More info about sending and setting up email here