简体   繁体   中英

rails 4 - sending mail locally not working

I am using devise which is sending confirmation email. I am not sure what it is doing, but I can see in the output of 'rails s' that mail is sent to correct emails.

config/environments/development.rb:

config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.delivery_method = :smtp 
config.action_mailer.smtp_settings = {
  address: 'smtp.gmail.com',
  port: 587,
  domain: 'localhost:3000',
  username: 'email@gmail.com',
  password: 'pwd',
  authentication: 'plain',
  enable_starttls_auto: true
}

I have seen many stackoverflow questions but everything showing this config only and this is not workng for me .

Its user_name but not username. Observer the underscore.

Also note that, domain is 'optional', so you can remove it.

And, set this (false by default):

config.action_mailer.raise_delivery_errors = true

if you want to see delivery errors

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM