-
Notifications
You must be signed in to change notification settings - Fork 81
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
Net::SMTP behaves differently in JRuby than in MRI #204
Comments
I can confirm we hit the same thing after upgrading to jruby-1.7.22. In our case, the SMTP server was also over port 25, but should be supporting STARTTLS (it's Mandrill's SMTP server if that helps). As one other data point, we were actually getting a slightly different error messages in our default jruby-1.7.22 installation originally:
However, after adding the latest |
We are seeing the same |
I cannot reproduce using jruby-1.7.22. What version of Java are you using? |
For me it's java version "1.7.0_85": |
The original report was using Oracle's java 8:
|
It seems to me that this is a failure to negotiate SSL handshake with the server in question.
In the above, you see that the negotiation fails with our SMTP service provider, but the same procedure works with Gmail. It is not clear to me what ciphers are tried and what ciphers problematic ones support, but whatever Gmail is using, JRuby 9k can use. (This happens with both 0.9.11 and 0.9.12 jruby-openssl gem.) |
I was debugging with -J-Djavax.net.debug=ssl option.
My Env
|
I've done some digging as well, and it turns out (no real surprise) that TLS is attempted in my case as well and that the cipher suite for my local postfix is the same as Mandrill's. My bet is that DES 40 is simply not supported anymore. |
Since I am also having the same issue and the culprit is mandrill, has anyone been able to fix this yet?
|
Workaround: |
@TheKidCoder : I had the same issue after changing the port to 465, It's because you need to start Postfix on your mac and also enable port 465, which is disabled by default:
|
To follow up on @k77ch7 's workaround, the following monkey patch works for me:
This will globally change SMTP to use a TLS v1.2 cipher suite, which avoids this issue. |
I encountered this error when using Rails with Postfix configured as a gmail relay on Ubuntu. The solution was to ensure that the default "TLS Parameters" are commented out or removed from /etc/postfix/main.cf after configuring the relay settings. Restart postfix after modifications to main.cf |
@maccharlesnmx Did you have this issue on a recent version of JRuby? The most recent replies here were all (somewhat older) versions of JRuby 1.7. |
@headius I'm using JRuby 9.1.12.0 To be clear, I was able to resolve the "Algorithm NONE not available" error by adjusting my Postfix configuration and no monkey patching. I posted my case here because it seemed like a very specific error message, and searching for it leads directly to this issue, so it might help others. I can't be certain that my case is the same as the original setup from @ylansegal, but it seems related to those who mention using JRuby with Postfix. |
I'm pretty sure this is really an OpenSSL bug so I'm transferring the issue there. Perhaps someone can test against a more recent JRuby? We expanded support for ciphers since this bug was last updated. |
Sometime after
jruby-1.7.19
a change was introduced that changes theNet::SMTP
behavior with respect with MRI.Repro:
In
jruby-1.7.22
andjruby-9.0.1.0
I get a Java stack-trace:I can confirm that in
jruby-1.7.19
and MRI (2.2.3
) the mail message is sent as expected.I think it's a little weird that the
mail
gem callenable_starttls_auto
by default, unless explicitly told not to (https://github.com/mikel/mail/blob/master/lib/mail/network/delivery_methods/smtp.rb), but in any case, I believe the difference in behavior of the current JRuby release and MRI is worth addressing.Please do let me know if more information is needed.
Thanks.
The text was updated successfully, but these errors were encountered: