简体   繁体   中英

Devise Not Sending Mail

I have the following in my config/environments/development.rb:

config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    :enable_starttls_auto => true,
    :address => "smtp.gmail.com",
    :port => 587,
    :domain => "mydomain.com",
    :authentication => :login,
    :user_name => "myemaiL@mydomain.com",
    :password => "mypass"
  }

But, when I browse to localhost:3000/users/sign_in and try to run a forgot password (test email sending), I get this error:

RuntimeError in Devise/passwords#create

Showing /Users/TTS/.rvm/gems/ruby-1.9.2-p180/gems/devise-1.3.3/app/views/devise/mailer/reset_password_instructions.html.erb where line #5 raised:

Missing host to link to! Please provide :host parameter or set default_url_options[:host]

Any thoughts?

looks like you need to provide a default_url for your environment. try adding something like config.action_mailer.default_url_options = { :host => 'localhost:3000' } to your development.rb file (assuming this is for development)

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