New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EOFError instead of SMTP error #27298
Comments
Can you please provide a sample application that reproduces the error? |
Same caveat here,
yields
|
To be clear, @rafaelfranca, my understanding is both the original script I provided and the second one are the same issue. The second example is closer to how we first encountered it - a very mysterious looking error out of an |
If you can reproduce the problem directly with |
Looks like Google is dropping the connection unceremoniously. The SMTP client sends a QUIT and waits for a response which will never come. EOFError is the expected exception for IO reads that expect a result but hit the end of the stream instead, and Whether bubbling up the underlying net/protocol exceptions useful for developers is… a good question! Action Mailer uses Mail which uses Net::SMTP which uses Net::Protocol. Arguably, this EOFError could be rescued and raised as a protocol error from Net::SMTP then rescued and raised as a Mail delivery error rather than exposing the underlying transport error. |
Agreed-ish. Whether
This is the impetus for the ticket - it took a non-trivial amount of time to find out where the error was coming from (recall there's no stack trace attached), and so it came across as a deficiency in Rails from my perspective. I can move this to Ruby or duplicate there as appropriate. |
Even though Google is violating the RFC ("The receiver MUST NOT intentionally close the transmission channel until it receives and replies to a QUIT command (even if there was an error).") by dropping the connection as soon as they send the An EOFError in general (at some other, not-trying-to-quit-anyway, time) doesn't strike me as entirely unreasonable to expose... but the missing backtrace seems improvable. At that point, I don't think we would need to do anything further: the Net::SMTPError in this case, and EOFError in the event of a more outright protocol violation, feels pretty consistent with how we handle exceptional circumstances elsewhere. |
I opened a similar Ruby ticket to deal with the If that's addressed on their end, I imagine the ActionMailer code would report it properly - if not, catching it and rethrowing the error with a stack trace would be a nice improvement in my view. |
FYI, there's a whole bunch of non-net/smtp errors that leak out - here's a list of exceptions that we've encountered on petition.parliament.uk: PERMANENT_FAILURES = [
Net::SMTPFatalError,
Net::SMTPSyntaxError
]
TEMPORARY_FAILURES = [
Net::SMTPAuthenticationError,
Net::OpenTimeout,
Net::SMTPServerBusy,
Errno::ECONNRESET,
Errno::ECONNREFUSED,
Errno::ETIMEDOUT,
Timeout::Error,
EOFError
] There's a couple more to add to that list - |
Someone left a comment on the Ruby bug saying it's unlikely a change (if any is to be made) would make it into Ruby 2.4. Perhaps worth taking a look at handling in the mean time to keep the exception from escaping ActionMailer? |
One thing we may be able to do in Action Mailer is to improve the behaviour of the job class that handles |
This issue has been automatically marked as stale because it has not been commented on for at least three months. |
I am facing the same issue, I have my own domain and i have got gsuite acoount, i created an email account on that and used it too send emails, and getting this error. My SMTP settings are:
|
I am getting this silent failure as well. All I get is the EOFError. Like sachin-metacube, I am using my own domain through a gsuite account. I wonder if this is a problem with Google that has started fairly recently? I was using identical settings May 13th (15 days ago), and they have stopped working. Is this an issue I should be bringing up with Google support? |
I fixed the problem I was having. Maybe this will help you. Step 1. Follow this guide here: Here are my Devise mailer settings:
|
Yes changing the port from 465 to 587 worked for me. Here is the real guide for gmail users if you are sending from @gmail.com: |
I had a EOFError as well. I was using the wrong port number (was using the smtp port when I was trying to use imap). Hopefully that helps the next person :) |
I faced the same issue with Gmail SMTP. Adding
|
In my case the issue was is sitting in middle proxy which blocks smtp. |
@SuprajaSuresh I came back to this issue over 4 years later after running into the same problem again working on a new app. Figured my past self could help. It did! And so did your addition. Thank you 🙏 |
Glad to know that it helped !!! |
Steps to reproduce
We are getting
EOFError
out of ActionMailer with no stack trace or useful error message. It appears to be bubbling out ofdeliver_now
. The code below requires a real email account, so I've excluded the details here -you'll need to provide them to get the script to work. I believe the code below reproduces the symptom, but not necessarily the cause.To be clear, it seems the error that arises when the
from
address is not appropriately authorized when coupled with the email address used to create the SMTP session. In the above code that discrepancy is captured by the difference betweenreal_email_address
andinconsistent from address
(which is presumably not authorized to send fromreal_email_address
).Expected behavior
Some form of actionable error, likely Net::SMTPError of some sort.
Actual behavior
System configuration
Rails version:
Rails 4.2.7.1
Ruby version:
jruby 9.1.6.0 (2.3.1) 2016-11-09 0150a76 OpenJDK 64-Bit Server VM 25.111-b14 on 1.8.0_111-8u111-b14-2ubuntu0.16.04.2-b14 +jit [linux-x86_64]
The text was updated successfully, but these errors were encountered: