08 JulActionMailer OpenSSL::SSL::SSLError

Friday, 08 July 2011 — 07:27

You probably reached this post because you’re getting the error “OpenSSL::SSL::SSLError (hostname was not match with the server certificate)” when you try to send an email in your rails >= 2.2.2 application using ActionMailer.

If your mail server lives is in the same machine of your rails application, here you’ll find a trick to quickly fix this forever.

Starting with Rails 2.2.2, ActionMailer will try to establish an encrypted connection with your mail server, when you send out an email. This is the default behavior. Fortunately, starting with Rails 2.2.3, there is a new option in ActionMailer::Base that will disable this.

If you like me, decided not to buy yet one those expensive certificates, you just need to add these lines to your environment.rb file, or environments/production.rb file:

# Turn off auto TLS for e-mail
ActionMailer::Base.smtp_settings[:enable_starttls_auto] = false

Ger

Comentarios

  1. Avatar Jesus Monzon
    08 Jul 08:19

    Gracias. Lo tendré en cuenta: en breves nos vamos a poner con meter ssl al proyecto y seguro que tu post ayuda a avitar una pequeña ostia

Añade tu comentario




(textile habilitado)
Negrita: *Google*
Enlace: "google.com":http://www.google.com
Imagen: !http://ggomeze.com/images/avatar.png!

ó Cancelar