Rails 4:EOFError:仅在开发中的任何电子邮件后到达文件结尾

Gho*_*der 9 email ruby-on-rails heroku devise

我有 rails 应用程序,它使用设计 ofr 身份验证和 sidekiq 进行后台电子邮件作业。突然之间,仅在开发中,我收到以下与尝试从应用程序发送电子邮件相关的错误(例如设计忘记密码)

     EOFError: end of file reached
Run Code Online (Sandbox Code Playgroud)

奇怪的是,生产中的应用程序可以正常工作(使用 sendgrid 设置 Heroku)。我没有更改任何开发电子邮件设置....

  ActionMailer::Base.default :from => 'slfwalsh@gmail.com'

    config.action_mailer.delivery_method = :smtp
    config.action_mailer.perform_deliveries = true
    config.action_mailer.raise_delivery_errors = true
    config.action_mailer.smtp_settings = {
      :address => "smtp.gmail.com",
      :port => 587,
      :domain => '@gmail.com',
      :user_name => "xxxxx@gmail.com",
      :password => "xxxxxxxx",
      :authentication => 'plain',
      :enable_starttls_auto => true
   }

    config.action_mailer.default_url_options = { :host => 'localhost:3000' }
Run Code Online (Sandbox Code Playgroud)

我在网上找不到任何可以解决此问题的内容。我还注意到,我在开发中的所有应用程序,使用类似的设置都会抛出相同的错误。我尝试了不同的电子邮件地址和密码(再次是 gmail),但没有成功....

Gho*_*der 2

对于那些陷入困境的人......这有效,但我不清楚为什么。

 config.action_mailer.raise_delivery_errors = true

 config.action_mailer.delivery_method = :smtp

 config.action_mailer.smtp_settings = {
  address: "smtp.gmail.com",
  port: 587,
  domain: "myprojectdomain.com",
  user_name: "xxxx@gmail.com",
  password: "xxxx",
  authentication: 'plain',
  enable_starttls_auto: true
 }

 config.action_mailer.default_url_options = { :host => 'localhost:3000' }
Run Code Online (Sandbox Code Playgroud)

  • 您在设置中更改了什么? (13认同)