我想通过PRODUCTION中的gmail帐户发送电子邮件.它在本地主机上运行良好.
在我的环境中.rb我有:
config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :address => "smtp.gmail.com",:port => 587,:domain => "myhost.com",:authentication => "plain",:user_name => "name@myhost.com",:password => "mypassword",:enable_starttls_auto => true
}
在我的production.rb文件中:
config.action_mailer.raise_delivery_errors = true config.action_mailer.default_url_options = { :host => 'gmail.com' }
Errno::ECONNREFUSED (Connection refused - connect(2)):
有任何想法吗 ?我的应用程序部署在Heroku上.
对于主持人我需要放什么?
谢谢 !
解决方法
主持人应该是www.yourapp.com.我在Heroku上设置gmail的设置如下所示,它们的工作原理如下:
config.action_mailer.default_url_options = { :host => 'www.myapp.com' } config.action_mailer.raise_delivery_errors = true config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :enable_starttls_auto => true,:address => "smtp.gmail.com",:port => 587,:domain => "gmail.com",:authentication => :login,:user_name => "user@myapp.com",:password => "mypassword" }
原文地址:https://www.jb51.cc/ruby/270093.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。