设计不发送邮件

发布于 2024-11-03 14:16:34 字数 924 浏览 2 评论 0原文

我的 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 => "[email protected]",
    :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]

有什么想法吗?

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 => "[email protected]",
    :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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉薄对峙 2024-11-10 14:16:34

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

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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文