Rails 2.3.9和SendGrid,连接被拒绝-本地主机上的connect(2) [英] Rails 2.3.9 and SendGrid, Connection refused - connect(2) on localhost
本文介绍了Rails 2.3.9和SendGrid,连接被拒绝-本地主机上的connect(2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经查看了Google和StackOverflow,无法解决这个问题。
I've looked through Google and StackOverflow and can't figure this out.
我有一个使用Ruby 1.8.7的Rails 2.3.9应用程序,尝试像这样通过SMTP发送电子邮件:
I've got a Rails 2.3.9 app using Ruby 1.8.7, trying to send email through SMTP like so:
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => '25',
:domain => "************.com",
:authentication => :plain,
:user_name => "***********",
:password => "**********"
}
我的应用回溯看上去像这样:
My app backtrace looks like this:
/Users/jared/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/net/smtp.rb:551:in `initialize'
/Users/jared/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/net/smtp.rb:551:in `open'
/Users/jared/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/net/smtp.rb:551:in `do_start'
/Users/jared/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/timeout.rb:67:in `timeout'
/Users/jared/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/timeout.rb:101:in `timeout'
/Users/jared/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/net/smtp.rb:551:in `do_start'
/Users/jared/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/net/smtp.rb:525:in `start'
/Users/jared/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-2.3.9/lib/action_mailer/base.rb:682:in `perform_delivery_smtp'
/Users/jared/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-2.3.9/lib/action_mailer/base.rb:523:in `__send__'
/Users/jared/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-2.3.9/lib/action_mailer/base.rb:523:in `deliver!'
/Users/jared/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-2.3.9/lib/action_mailer/base.rb:429:in `deliver'
/Users/jared/rails/********/app/models/user.rb:160:in `send_welcome_email'
/Users/jared/rails/*********/app/controllers/users_controller.rb:35:in `create'
推荐答案
我知道了。我的ISP阻止了端口25,所以我不得不更改配置:
I figured it out. My ISP was blocking port 25, so I had to change my configuration:
ActionMailer::Base.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => '587',
:domain => "**********.com",
:authentication => :plain,
:user_name => "************",
:password => "*********",
:enable_starttls_auto => true
}
这篇关于Rails 2.3.9和SendGrid,连接被拒绝-本地主机上的connect(2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文