Search code examples
ruby-on-railsruby-on-rails-3devisesmtp

Rails Devise Mailer: No Received Messages in Inbox


I'm using Rails 4 and Devise 3. I need to send confirmation e-mails for production. These are the SMTP configs for my config/environments/production.rb

config.action_mailer.default_url_options = { :host => 'smtp.gmail.com' }
  config.action_mailer.raise_delivery_errors = false
  config.action_mailer.perform_deliveries = true
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
      :address              => "smtp.gmail.com",
      :tls                  => true,
      :port                 => '587',
      :user_name            => 'my_email@gmail.com',
      :password             => 'my_password',
      :authentication       => 'plain',
      :enable_starttls_auto => true
    }

Logs say that the e-mail's been sent. However, I don't see anything in the inbox. (yes, mailcatcher is off)

Another question, do the configs of the development file affect the production's environment's in any ways? They shouldn't, correct?

Another important question: Using the way above, how many e-mails can be handled? For an example, if I used a third party say, Mandrill, would be better because up for tens of thousands of e-mails can be handled. What about this way? P.S I've already tried Mandrill and it worked just fine. I am requested not to use a third party though so I won't be able to use Mandrill.

Lastly, is there any other way of sending the confirmation e-mails from the Rails Devise that I'm unaware of yet? Or are there any other configurations that I need to do OUTSIDE OF RAILS to make this work since I won't be using a third party?


Solution

  • Please make sure you have enter correct host name .

    config.action_mailer.default_url_options = { :host => 'your domain name' }

    As Rails configuration standard if your application running on local machine it loads development env. file settings, if it is production then it load production env. file settings.

    I prefer to use sendgrid or Mandrill by MailChimp, if you ave large application then it is better to use 3rd party addons, for small application you can use Gmail .

    hope this will help you :)