我在使用 ruby on rails 发送电子邮件时遇到问题。当我使用 gmail smtp 时,它工作正常,但是当我尝试使用我在 cpanel 中创建的电子邮件时,我现在似乎无法发送任何电子邮件。有谁知道如何配置这个?谢谢。
这是我在 initializers 文件夹下的 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 => "info@humouno.com",
:password => "********",
:authentication => "login",
:enable_starttls_auto => true
}
这里是environment.rb下的development.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
我正在尝试在我的本地主机中发送电子邮件。
最佳答案
感谢其他答案,但我发现 smtp 端口应该是 587
而不是 25
,我觉得很奇怪,因为在 cpanel 配置中,它说smtp 端口在端口 25。
关于ruby-on-rails - 在 rails 开发环境 smtp cpanel 上发送电子邮件 ruby,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22138699/