Question

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.

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.

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

Was it helpful?

Solution

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

OTHER TIPS

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

Or for the example above:

:domain => 'gmail.com',

I found one cause for the error here => https://stackoverflow.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...

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.

2) Connect ActionMailer to gmail account 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:

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.

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,
      }
    })

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.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top