保存设计用户时Rails EOFError(到达文件末尾)

时间:2023-01-23 18:13:36

I'm getting this error in production when trying to create a user (i'm using the devise gem).

我在尝试创建用户时遇到了这个错误(我正在使用设计宝石)。

EOFError (end of file reached):

I hit this problem before and it was due to my smtp settings using zoho mail.

我之前遇到过这个问题,这是由于我使用zoho邮件的smtp设置。

I believe my configuration below is what fixed the problem:

我相信我的配置是解决问题的原因:

ActionMailer::Base.delivery_method = :smtp  
ActionMailer::Base.smtp_settings = {            
  :address              => "smtp.zoho.com", 
  :port                 => 465,              
  :domain               => 'example.com',   
  :user_name            => 'user@example.com',
  :password             => 'password',         
  :authentication       => :login,
  :ssl                  => true,
  :tls                  => true,
  :enable_starttls_auto => true    
}

Now we've added SSL to the site and I believe that is what is causing this error to occur now.

现在我们已经向网站添加了SSL,我相信这就是导致此错误发生的原因。

Does anyone have any insight into this error or zoho mail smtp settings with SSL?

有没有人对SSL的错误或zoho邮件smtp设置有任何了解?

5 个解决方案

#1


37  

This error was caused by not having my config/initializers/devise.rb specifying the correct email address for config.mailer_sender.

此错误是由于没有我的config / initializers / devise.rb指定config.mailer_sender的正确电子邮件地址引起的。

#2


3  

Also! I made this additional mistake and had the same issue: I used my own domain instead of the mail server domain for the "domain" variable.

也!我犯了这个额外的错误并遇到了同样的问题:我使用自己的域而不是邮件服务器域来获取“域”变量。

Your environment variable should be:

您的环境变量应该是:

GMAIL_DOMAIN=gmail.com

GMAIL_DOMAIN = gmail.com

Or for the example above:

或者对于上面的例子:

:domain => 'gmail.com',

:domain =>'gmail.com',

#3


1  

Here's a working pony gem call.

这是一个有效的小马宝石电话。

Pony.mail({
      :to => 'apotonick@gmail.com',
      subject: "Pony ride",
      body: "Awesome!",
      from: "nick@trb.to", # this MUST be the sending Zoho email.

      :via => :smtp,
      :via_options => {
        :address        => 'smtp.zoho.com',
        :port           => '465',
        :enable_starttls_auto => true,
        ssl: true,
        :user_name      => 'nick@trb.to', # MUST be identical to :from.
        :password       => 'yourStrongPw',
        :authentication => :login,
      }
    })

#4


1  

I found one cause for the error here => https://*.com/a/40354121/6264112

我发现错误的原因有一个=> https://*.com/a/40354121/6264112

But this didn't solve my issue. While I wasn't getting any errors, my emails were still not working through Zoho so I found another solution that works perfectly for my needs...

但这并没有解决我的问题。虽然我没有收到任何错误,但我的电子邮件仍然无法通过Zoho工作,因此我找到了另一种完全符合我需求的解决方案......

1) Connect Zoho to gmail using SMTP. I setup my zoho email as an alias for my personal gmail account so zoho emails are forwarded to gmail and I can reply to them IN gmail FROM my zoho email address. This should be done anyways so you never have to login to zoho. Just do all emailing from gmail.

1)使用SMTP将Zoho连接到gmail。我将我的zoho电子邮件设置为我的个人Gmail帐户的别名,以便将zoho电子邮件转发到gmail,我可以通过我的zoho电子邮件地址回复它们。无论如何都应该这样做,所以你永远不必登录zoho。只需从gmail发送所有电子邮件。

2) Connect ActionMailer to gmail account NOT zoho.

2)将ActionMailer连接到gmail帐户NOT zoho。

config.action_mailer.smtp_settings = {
    :address                          => 'smtp.gmail.com',
    :port                                 => 587,
    :user_name                     => ENV["gmail_username"],
    :password                       => ENV["gmail_password"],
    :authentication                => :plain,
    :enable_starttls_auto     => true
}

Now, I just need to specify the to and from values in the mailer like so:

现在,我只需要在邮件程序中指定to和from值,如下所示:

def notify_admin (message_details)
    @message_details = message_details
    mail(to: "jesse@mydomain.com", subject: "Contact form filled out by: " + message_details[:name], from: message_details[:email])
end

This works when I want to send emails to myself as is the example above when someone submits the contact form.

当我想向某人发送电子邮件时,这就行了,就像上面有人提交联系表格时的例子一样。

It ALSO works when I want to send an email from my domain such as when they fill out the lead magnet. All I did was switch the to: and from: addresses.

当我想从我的域发送电子邮件时,例如当他们填写铅磁铁时,它也可以工作。我所做的就是切换到:和来自:地址。

#5


0  

I had this issue, and I tried everything and still couldn't figure out what the issue was.

我有这个问题,我尝试了一切,仍然无法弄清问题是什么。

Let's face it, it's a SH!t message. What I did find though I was running my rails app locally with POW and its actually a POW error.

让我们面对现实,这是一条SH!t消息。虽然我在POW本地运行我的rails应用程序并且实际上是POW错误,但我找到了什么。

When I run rails server and do the same thing that caused the error, I actually got the real error message and was able to find I hadn't setup my controller correctly

当我运行rails服务器并做同样的事情导致错误,我实际上得到了真正的错误消息,并能够找到我没有正确设置我的控制器

#1


37  

This error was caused by not having my config/initializers/devise.rb specifying the correct email address for config.mailer_sender.

此错误是由于没有我的config / initializers / devise.rb指定config.mailer_sender的正确电子邮件地址引起的。

#2


3  

Also! I made this additional mistake and had the same issue: I used my own domain instead of the mail server domain for the "domain" variable.

也!我犯了这个额外的错误并遇到了同样的问题:我使用自己的域而不是邮件服务器域来获取“域”变量。

Your environment variable should be:

您的环境变量应该是:

GMAIL_DOMAIN=gmail.com

GMAIL_DOMAIN = gmail.com

Or for the example above:

或者对于上面的例子:

:domain => 'gmail.com',

:domain =>'gmail.com',

#3


1  

Here's a working pony gem call.

这是一个有效的小马宝石电话。

Pony.mail({
      :to => 'apotonick@gmail.com',
      subject: "Pony ride",
      body: "Awesome!",
      from: "nick@trb.to", # this MUST be the sending Zoho email.

      :via => :smtp,
      :via_options => {
        :address        => 'smtp.zoho.com',
        :port           => '465',
        :enable_starttls_auto => true,
        ssl: true,
        :user_name      => 'nick@trb.to', # MUST be identical to :from.
        :password       => 'yourStrongPw',
        :authentication => :login,
      }
    })

#4


1  

I found one cause for the error here => https://*.com/a/40354121/6264112

我发现错误的原因有一个=> https://*.com/a/40354121/6264112

But this didn't solve my issue. While I wasn't getting any errors, my emails were still not working through Zoho so I found another solution that works perfectly for my needs...

但这并没有解决我的问题。虽然我没有收到任何错误,但我的电子邮件仍然无法通过Zoho工作,因此我找到了另一种完全符合我需求的解决方案......

1) Connect Zoho to gmail using SMTP. I setup my zoho email as an alias for my personal gmail account so zoho emails are forwarded to gmail and I can reply to them IN gmail FROM my zoho email address. This should be done anyways so you never have to login to zoho. Just do all emailing from gmail.

1)使用SMTP将Zoho连接到gmail。我将我的zoho电子邮件设置为我的个人Gmail帐户的别名,以便将zoho电子邮件转发到gmail,我可以通过我的zoho电子邮件地址回复它们。无论如何都应该这样做,所以你永远不必登录zoho。只需从gmail发送所有电子邮件。

2) Connect ActionMailer to gmail account NOT zoho.

2)将ActionMailer连接到gmail帐户NOT zoho。

config.action_mailer.smtp_settings = {
    :address                          => 'smtp.gmail.com',
    :port                                 => 587,
    :user_name                     => ENV["gmail_username"],
    :password                       => ENV["gmail_password"],
    :authentication                => :plain,
    :enable_starttls_auto     => true
}

Now, I just need to specify the to and from values in the mailer like so:

现在,我只需要在邮件程序中指定to和from值,如下所示:

def notify_admin (message_details)
    @message_details = message_details
    mail(to: "jesse@mydomain.com", subject: "Contact form filled out by: " + message_details[:name], from: message_details[:email])
end

This works when I want to send emails to myself as is the example above when someone submits the contact form.

当我想向某人发送电子邮件时,这就行了,就像上面有人提交联系表格时的例子一样。

It ALSO works when I want to send an email from my domain such as when they fill out the lead magnet. All I did was switch the to: and from: addresses.

当我想从我的域发送电子邮件时,例如当他们填写铅磁铁时,它也可以工作。我所做的就是切换到:和来自:地址。

#5


0  

I had this issue, and I tried everything and still couldn't figure out what the issue was.

我有这个问题,我尝试了一切,仍然无法弄清问题是什么。

Let's face it, it's a SH!t message. What I did find though I was running my rails app locally with POW and its actually a POW error.

让我们面对现实,这是一条SH!t消息。虽然我在POW本地运行我的rails应用程序并且实际上是POW错误,但我找到了什么。

When I run rails server and do the same thing that caused the error, I actually got the real error message and was able to find I hadn't setup my controller correctly

当我运行rails服务器并做同样的事情导致错误,我实际上得到了真正的错误消息,并能够找到我没有正确设置我的控制器