How to fix issues with SSL certificate?

This article is about the following errors:

Error 1: Upon receving mail

Error: SSL_connect returned=1 errno=0 state=error: certificate verify failed

Error 2: Upon sending mail

An error occurred while sending mail (hostname "" does not match the server certificate)

In these cases the following changes could help.

1. Error:

Create a new file config/initializers/bypass_ssl_verification.rb (the name of the file is not important) with the following content:

require 'openssl'

Save the changes and restart the web-server.

2. Error:

In file


add the line

:openssl_verify_mode => OpenSSL::SSL::VERIFY_NONE,

at the place shown below:

  def set_delivery_options
    return false if HelpdeskSettings[:helpdesk_smtp_use_default_settings,].to_i == 0
    message.delivery_method.settings.merge!(:address => HelpdeskSettings[:helpdesk_smtp_server,],
                            :port => HelpdeskSettings[:helpdesk_smtp_port,] || 25,
                            :authentication => HelpdeskSettings[:helpdesk_smtp_authentication,] || 'plain',
                            :user_name => HelpdeskSettings[:helpdesk_smtp_username,],
                            :password => HelpdeskSettings[:helpdesk_smtp_password,],
                            :domain => HelpdeskSettings[:helpdesk_smtp_domain,],
                            :enable_starttls_auto => true,
                 here ->    :openssl_verify_mode => OpenSSL::SSL::VERIFY_NONE,
                            :ssl => HelpdeskSettings[:helpdesk_smtp_ssl,].to_i > 0 &&
                                    HelpdeskSettings[:helpdesk_smtp_tls,].to_i == 0)

Save the changes and restart the web-server.

Was this article helpful? Yes  No
75 from 137 found this helpful