简体   繁体   English

Rails 4-在本地发送邮件不起作用

[英]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. 我不确定它在做什么,但是我可以在“ rails s”的输出中看到该邮件已发送到正确的电子邮件中。

config/environments/development.rb: 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 . 我已经看到了很多stackoverflow问题,但是所有内容仅显示此配置,这对我来说不起作用。

Its user_name but not username. 它的用户名,但不是用户名。 Observer the underscore. 观察下划线。

Also note that, domain is 'optional', so you can remove it. 另请注意,domain是“可选”的,因此您可以将其删除。

And, set this (false by default): 并且,设置此值(默认情况下为false):

config.action_mailer.raise_delivery_errors = true

if you want to see delivery errors 如果您想查看送货错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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