ruby-on-rails – Rails:在生产中通过Gmail发送电子邮件
发布时间:2020-12-16 19:08:11 所属栏目:百科 来源:网络整理
导读:我想通过PRODUCTION中的gmail帐户发送电子邮件.它在本地主机上运行良好. 在我的环境中.rb我有: config.action_mailer.delivery_method = :smtpconfig.action_mailer.smtp_settings = { :address = "smtp.gmail.com",:port = 587,:domain = "myhost.com",:au
我想通过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" } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |