Question

I'm having trouble sending email using ruby on rails. When I'm using the gmail smtp, it's working fine but when I tried to use the email I created in cpanel, I can't seem to send any emails now. Does anyone know how to configure this? Thanks.

here's my mailer_setup.rb under initializers folder

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
}

Here's the development.rb under 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

I'm trying to send the email in my localhost.

Was it helpful?

Solution

Thanks for the other answers but I found out that the smtp port should be 587 instead of 25, I find it weird since in the cpanel config, it says that the smtp port is at port 25.

OTHER TIPS

When I'm using the gmail smtp

why smtp_settings.address is not smtp.gmail.com? please check http://apidock.com/rails/ActionMailer/Base (Configuration options) and https://support.google.com/mail/answer/13287

and if using your smtp server is collect; I'd tail that some logs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top