Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 如何在RubyonRails中使用smtp从本地主机发送邮件?_Ruby On Rails 4_Smtp_Localhost_Mailer - Fatal编程技术网

Ruby on rails 4 如何在RubyonRails中使用smtp从本地主机发送邮件?

Ruby on rails 4 如何在RubyonRails中使用smtp从本地主机发送邮件?,ruby-on-rails-4,smtp,localhost,mailer,Ruby On Rails 4,Smtp,Localhost,Mailer,我正在使用RubyonRails4.0.1框架,希望使用ActiveMailer在localhost:3000上通过smtp.gmail.com向新注册的用户发送邮件,我已经设置好了一切。邮件在日志中进行处理,它还显示“已处理出站异常”,但到目前为止,我还没有收到任何邮件。任何线索将不胜感激 谢谢在您的配置/environments/*.rb中,您可以将操作邮件设置为 config.action_mailer.deconfig.action_mailer.delivery_method = :s

我正在使用RubyonRails4.0.1框架,希望使用ActiveMailer在localhost:3000上通过smtp.gmail.com向新注册的用户发送邮件,我已经设置好了一切。邮件在日志中进行处理,它还显示“已处理出站异常”,但到目前为止,我还没有收到任何邮件。任何线索将不胜感激


谢谢

在您的配置/environments/*.rb中,您可以将操作邮件设置为

config.action_mailer.deconfig.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :domain               => 'domain'
  :user_name            => 'username@gmail.com',
  :password             => 'xxxxxxx',
  :authentication       => 'plain',
  :enable_starttls_auto => true  }
注意:如果您使用的是开发环境,请更改配置/environments/development.rb以引发交付错误,包括:

config.action\u mailer.raise\u delivery\u errors=true