2014-03-03 54 views
1

我在使用ruby在rails上发送电子邮件时遇到问题。当我使用gmail smtp时,它运行良好,但是当我尝试使用我在cpanel中创建的电子邮件时,我现在似乎无法发送任何电子邮件。有谁知道如何配置这个?谢谢。发送电子邮件红宝石在rails dev环境smtp cpanel

这里是我的mailer_setup.rb下初始化文件夹

ActionMailer::Base.delivery_method = :smtp # be sure to choose SMTP delivery 
ActionMailer::Base.smtp_settings = { 
    :address    => "mail.humouno.com", 
    :port     => 25, 
    :domain    => "humouno.com", 
    :user_name   => "[email protected]", 
    :password    => "********", 
    :authentication  => "login", 
    :enable_starttls_auto => true 
} 

这里下的environment.rb

Humouno::Application.configure do 
    config.cache_classes = false 
    config.eager_load = false 

    config.consider_all_requests_local  = true 
    config.action_controller.perform_caching = false 

    config.action_mailer.raise_delivery_errors = false 

    config.active_support.deprecation = :log 

    config.active_record.migration_error = :page_load 
    config.action_mailer.perform_deliveries = true 

    config.assets.debug = true 
end 

我试图发送电子邮件在我的本地主机的development.rb。

+0

你能更改'config.action_mailer.raise_delivery_errors'为true,重新启动并发布错误? – steakchaser

回答

3

感谢其他的答案,但我发现,SMTP端口应587而不是25,我发现因为在的cPanel配置很奇怪,它说,SMTP端口为端口25

+0

谢谢!你的回答救了我!我说使用465作为外出端口..尝试端口587和whooopaaa“你有邮件”...不幸的是花费了至少一个小时之前,我找到了你的答案,谢谢!任何人知道为什么587作品和其他建议的港口不是? – PSR

相关问题