设计不发送邮件
我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您需要为您的环境提供一个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)