A solution for: An error occurred while sending mail (SSL_connect returned=1 errno=0 state=unknown state: unknown protocol) in Redmine 2.0 / Rails 3.2.3May 29, 2012 · by Tim Kamanin
Being a Drupal developer I do use magnificent redmine (http://redmine.org) to manage my tasks and projects. If you don't know, Redmine is a Rails-based application so from time to time I have my hands dirty with ruby code (it doesn't hurt at all ;)).
Today I decided to upgrade our internal redmine installation from version 1.4 to 2.0. The upgrade process went very smooth, but in the end I encountered a problem with mail sending. Every attempt to send an email from redmine installation led to the error message: An error occurred while sending mail (SSL_connect returned=1 errno=0 state=unknown state: unknown protocol). I use Google Apps SMTP servers for mail, so my configuration file looked something like this:
production: email_delivery: delivery_method: :smtp smtp_settings: tls: true enable_starttls_auto: true address: "smtp.gmail.com" port: 587 domain: "smtp.gmail.com" # 'your.domain.com' for GoogleApps authentication: :plain user_name: "firstname.lastname@example.org" password: "your_password"
With redmine 1.4 these settings worked just fine, but redmine 2.0 made a major jump from Rails 2.3.x to rails 3.2.x and, as it usually happens in the Rails world, something has changed in the internals. In the end it turned out that you can't have both _tls: true_ and _ _ _enable_starttls_auto: true _in your settings, so you need to comment tls: true setting and your redmine will be able to send email messages via Google's SMTP. Hope this will be helpful to someone.