Carson Carson - 7 days ago 6
Ruby Question

Setting up a gmail with devise confirmation

I want to setup a gmail account to send out the confirmation emails and reset emails for when signing up on my Ruby on Rails site. I just want to use a gmail account for now, and switch to a proper like noreply@mydomain.com later.

I've gotten so it doesn't get any errors when it runs. I can create an account, it generates the correct views and everything, and Mailcatcher says it sends the email. It doesn't however say the email was sent on the gmail account nor do I see the email in my inbox or spam folder.

I tried following numerous guides and stackoverflow questions, but I can't seem to figure it out. Such as this, this, and others but no luck. Any help?

I setup /initializers/devise.rb file with...

config.mailer_sender = 'shiplistconfrimation@gmail.com'
...
config.reconfirmable = false


Then my development.rb file like so...

config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {:address => "localhost", :port => 1025}
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "gmail.com",
:user_name => "shiplistconfrimation@gmail.com",
:password => "<PASSWORD>",
:authentication => "plain",
:ssl => true,
:tsl => true
# :enable_starttls_auto => true # I don't have this, but it should work anyway
}


With being my password removed from this question.

Answer

Do following things

ADD in ActionMailer::Base.smtp_settings

enable_starttls_auto: true

REMOVE

config.action_mailer.smtp_settings = {:address => "localhost", :port => 1025}

This will solve your issue

Comments