2011-04-26 50 views
0

在我的配置/環境/ 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 => "[email protected]", 
    :password => "mypass" 
    } 

但是,當我瀏覽到localhost:3000 /用戶/ sign_in並嘗試運行忘記密碼(測試電子郵件發送),我得到這個錯誤:

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] 

有什麼想法?

回答

3

看起來像你需要爲你的環境提供一個default_url。嘗試添加像config.action_mailer.default_url_options = { :host => 'localhost:3000' }到您的development.rb文件(假設這是用於開發)