2014-10-07 69 views
1

我在使用Unicorn和Nginx的自己的服務器上託管Rails應用程序。我有一個問題,當我嘗試使用發送郵件山魈,我得到以下錯誤:使用Mandrill smtp在Rails應用程序發送郵件

Net::SMTPServerBusy: 401 Syntax: HELO hostname 

這是我的配置上production.rb:

config.action_mailer.delivery_method = :smtp 
config.action_mailer.perform_deliveries = true 
config.action_mailer.raise_delivery_errors = true 
config.action_mailer.default charset: 'utf-8' 
config.action_mailer.smtp_settings = { 
    address: 'smtp.mandrillapp.com', 
    port: 587, 
    authentication: "plain", 
    domain: localhost, 
    enable_starttls_auto: true, 
    user_name: ENV['MANDRILL_USERNAME'], 
    password: ENV['MANDRILL_API_KEY'] 
} 

我從錯誤中得到的是這可能是mandrill拒絕域名,因爲不是「安全/註冊」??

我已經嘗試將域名更改爲'timewarp.us'(尚未註冊),並且我遇到了同樣的問題。

如果我更改madrill並使用Gmail郵件smtp它按預期工作。

這是我第一次對服務器進行部署,我有點不知所措。

任何幫助將是偉大的。謝謝!

回答

1

嘗試添加您的實際域而不是localhost。我的猜測是Mandrill不接受本地主機作爲主機名。

+0

我試着改變「本地主機」爲「timewarp.us」,仍然得到相同的錯誤:/ – gustavoca 2014-10-07 19:48:57

+0

給它一個實際的user_name和密碼。它可能沒有選擇你的ENV變量。另外,我剛剛嘗試ping'timewarp.us',主機名無法解析。我猜這是你的問題。 – 2014-10-07 20:21:09

+0

想象一下,即時消息不會在我的rails應用上使用figaro,嘿嘿。我正在使用「secrets.yml」文件..我的壞。而不是使用ENV ['']來使用Rails.application.secrets。 gustavoca 2014-10-07 21:25:27