Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sendmail: OpenSSL::SSL::SSLError: hostname was not match

I have a vps with ubuntu 10.04. i'm tring to install a rails 3 application If i try to test the sendmail command from terminal it works.

In my application,for the mail, i have inserted in application.rb file:

config.action_mailer.delivery_method = :sendmail
    config.action_mailer.sendmail_settings = {
        :location       => '/usr/sbin/sendmail',
        :arguments      => '-i -t'
    } 

But if i try to send an email with rails i receive this error:

OpenSSL::SSL::SSLError: hostname was not match with the server certificate
    from /opt/ruby/lib/ruby/1.8/openssl/ssl-internal.rb:123:in `post_connection_check'

How can i do?

thanks

like image 713
Luca Romagnoli Avatar asked Jun 22 '11 12:06

Luca Romagnoli


2 Answers

Maybe you need

:openssl_verify_mode  => 'none'

per Rails 3 actionmail OpenSSL::SSL::SSLError

like image 142
Seamus Abshere Avatar answered Nov 12 '22 18:11

Seamus Abshere


just add to your enviroment.rb

module OpenSSL
  module SSL
    remove_const :VERIFY_PEER
  end
end
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
like image 1
achempion Avatar answered Nov 12 '22 19:11

achempion