0

I have a Rails app that's being a little contrary. When I execute this command:

[1] pry(main)> Jobs::TestEmail.new.execute(to_address: "destination@domain.tld")

It returns this error:

OpenSSL::SSL::SSLError: hostname "smtp.domain.tld" does not match the server certificate
from /usr/local/lib/ruby/2.5.0/openssl/ssl.rb:394:in `post_connection_check'

I don't have any trouble sending emails normally with this server via clients OR swaks for example... It's only happening in Rails. Is there something extra that Rails is doing that I can disable or change the restriction level that will eliminate this issue?

anothermh
  • 9,815
  • 3
  • 33
  • 52
ylluminate
  • 12,102
  • 17
  • 78
  • 152
  • 1
    You want to ignore OpenSSL's warning that the host you're connecting to doesn't have a valid certificate? [That's bad and you shouldn't do that but it is possible](https://stackoverflow.com/questions/1113422/how-to-bypass-ssl-certificate-verification-in-open-uri). As for why it doesn't happen with swaks or "via clients" (what does that even mean?), they probably aren't using TLS. – anothermh Dec 02 '18 at 01:22
  • What is the purpose of this job? Is it to be run in a test environment only? – lacostenycoder Dec 02 '18 at 05:14
  • Here are some more details as to why this question arose: https://serverfault.com/questions/942499/smtp-problems-due-to-cn-vs-sni-on-the-certificate - perhaps this will shine some light onto the why and where. – ylluminate Dec 02 '18 at 07:51

0 Answers0