Rails Mailer Net :: SMTPServerBusy [英] Rails Mailer Net::SMTPServerBusy

查看:93
本文介绍了Rails Mailer Net :: SMTPServerBusy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过我的rails网站,当我尝试通过GMail发送邮件时,它完美地工作。但是,当我尝试通过MandrillApp发送它时,它会给出以下错误(RController.create是调用传递命令的地方):

  Net :: SMTPServerBusy in RController#create 
454 4.7.1< recipient@gmail.com>:中继访问被拒绝

这是我的config / environments / development.rb文件:

 #ActionMailer配置
config.action_mailer.default_url_options = {:host => 'localhost:3000'}
config.action_mailer.delivery_method =:smtp
config.action_mailer.default:charset => utf-8

config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true

config.action_mailer.delivery_method =:smtp
#config.action_mailer.smtp_settings = {
#:address => smtp.gmail.com,
#:port => 587,
#:domain => 'gmail.com',
#:user_name => 'sender@gmail.com',
#:password => 'password',
#:authentication => 'plain',
#:enable_starttls_auto => true}

config.action_mailer.smtp_settings = {
:address => smtp.mandrillapp.com,
:port => 587,
:user_name => ENV [EMAIL],
:password => ENV [PASSWORD]
}

如上所述,代码不会工作 - 我没有收到电子邮件,也没有出现错误。如果我转而从GMail发送它,我几乎立即收到一封电子邮件。我从来没有与Mandrill合作过,所以任何帮助,将不胜感激。

解决方案

我最终与Mandrill的服务代表通话,事实证明我使用的是实际的字符串,而不是环境变量,所以我只需要从配置文件中删除ENV。

为了安全起见,我最终返回并创建了环境变量,但是我只是认为我会将其抛出,以防其他人遇到同样的问题并发现此问题题。

With my rails site, when I try to send mail through GMail, it works perfectly. But when I try to send it through MandrillApp, it gives the following error (RController.create is where the deliver command is called):

Net::SMTPServerBusy in RController#create 
454 4.7.1 <recipient@gmail.com>: Relay access denied

Here's my config/environments/development.rb file:

 # ActionMailer Config
 config.action_mailer.default_url_options = { :host => 'localhost:3000' }
 config.action_mailer.delivery_method = :smtp
config.action_mailer.default :charset => "utf-8"

config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true

config.action_mailer.delivery_method = :smtp
# config.action_mailer.smtp_settings = {
#   :address              => "smtp.gmail.com",
#   :port                 => 587,
#   :domain               => 'gmail.com',
#   :user_name            => 'sender@gmail.com',
#   :password             => 'password',
#   :authentication       => 'plain',
#   :enable_starttls_auto => true  }

config.action_mailer.smtp_settings = {
:address   => "smtp.mandrillapp.com",
:port      => 587,
:user_name => ENV["EMAIL"],
:password  => ENV["PASSWORD"]
}

As it is above, the code doesn't work - I don't get an email and no errors pop up. If I switch to sending it from GMail, I get an email almost instantly. I've never worked with Mandrill before, so any help would be appreciated.

解决方案

I ended up talking to a service rep from Mandrill, and it turns out that I was using the actual strings instead of the environment variables, so I just had to remove "ENV" from the config file.

I ended up going back and making environment variables for security's sake, but I just thought I'd throw that out there in case anyone else has the same problem and finds this question.

这篇关于Rails Mailer Net :: SMTPServerBusy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆