【问题标题】:Devise Not Sending Mail设计不发送邮件
【发布时间】:2011-04-26 17:04:54
【问题描述】:

我的 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"
  }

但是,当我浏览到 localhost:3000/users/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]

有什么想法吗?

【问题讨论】:

    标签: ruby-on-rails email devise actionmailer


    【解决方案1】:

    看起来您需要为您的环境提供一个 default_url。尝试在你的 development.rb 文件中添加类似config.action_mailer.default_url_options = { :host => 'localhost:3000' } 的内容(假设这是用于开发)

    【讨论】:

      猜你喜欢
      • 2011-10-23
      • 1970-01-01
      • 2016-08-11
      • 2011-10-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多