Error while sending email through Gmail.

Added by David Díaz about 2 years ago

I get the error: "Ha ocurrido un error mientras enviando el correo (SSL_connect returned=1 errno=0 state=unknown state: unknown protocol)"

System configuration:
- Ubuntu 64
- Apache 2.2
- mod_passenger

Environment configuration:
Environment:
- Redmine version 2.0.0.stable.9699
- Ruby version 1.9.3 (x86_64-linux)
- Rails version 3.2.3
- Environment production
- Database adapter PostgreSQL
Redmine plugins:
no plugin installed

I'm using Redmine 2.0 stable after upgrading from 1.3 (where this configuration works) with the following gemset:

actionmailer (3.2.3)
actionpack (3.2.3)
activemodel (3.2.3)
activerecord (3.2.3)
activeresource (3.2.3)
activesupport (3.2.3)
arel (3.0.2)
builder (3.0.0)
bundler (1.1.3)
coderay (1.0.6)
daemon_controller (1.0.0)
erubis (2.7.0)
fastthread (1.0.7)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.3)
json (1.7.3)
mail (2.4.4)
mime-types (1.18)
multi_json (1.3.5)
net-ldap (0.3.1)
passenger (3.0.12)
pg (0.13.2)
polyglot (0.3.3)
prototype-rails (3.2.1)
rack (1.4.1)
rack-cache (1.2)
rack-openid (1.3.1)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.3)
railties (3.2.3)
rake (0.9.2.2)
rdoc (3.12)
rmagick (2.13.1)
ruby-openid (2.1.8)
rubygems-bundler (1.0.0)
rvm (1.11.3.3)
sprockets (2.1.3)
sqlite3 (1.3.6)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33)

My email configuration is:

production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      tls: true
      enable_starttls_auto: true
      address: "smtp.gmail.com" 
      port: '587'
      domain: "smtp.gmail.com" 
      authentication: :plain
      user_name: "<user@gmail.com>" 
      password: "<password>" 

Thanks

Replies (9)

RE: Error while sending email through Gmail. - Added by Aleksander Demidov about 2 years ago

Yes. I connect in this topic. Redmine 2.0 + Rails 3 = not work sending email via gmail.
action_mailer_optional_tls plugin not work.
Unable to setting SSL an this doc: http://edgeguides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration-for-gmail

Any ideas?

SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol

RE: Error while sending email through Gmail. - Added by David Díaz about 2 years ago

Hi! I found that it is a configuration problem.

First, use the configuration.yml of the redmine2.0 instalation. Don't copy/paste from another version. Then, check all the document to comment all the email configuration blocks. Then use the following email configuration block with exactly the same quotes (only on user_name):

production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      enable_starttls_auto: true
      address: smtp.gmail.com
      port: 587
      domain: smtp.gmail.com
      authentication: :plain
      user_name: "user@gmail.com" 
      password: password

RE: Error while sending email through Gmail. - Added by Aleksander Demidov about 2 years ago

David Díaz wrote:

Hi! I found that it is a configuration problem.

First, use the configuration.yml of the redmine2.0 instalation. Don't copy/paste from another version. Then, check all the document to comment all the email configuration blocks. Then use the following email configuration block with exactly the same quotes (only on user_name):

[...]

ohh.. no. It is not work. Without option "tls: true" - I fetched error "530 5.7.0 Must issue a STARTTLS command first". It`s one.
It`s two: Quotes allowed for password and user_name fields - this doc http://www.redmine.org/projects/redmine/wiki/EmailConfiguration#Asynchronous-delivery_methods
OR
in source configuration.yml.example https://github.com/redmine/redmine/blob/master/config/configuration.yml.example
@# ==== SMTP server at using TLS (GMail) #
  1. This might require some additional configuration. See the guides at:
  2. http://www.redmine.org/projects/redmine/wiki/EmailConfiguration #
  3. production:
  4. email_delivery:
  5. delivery_method: :smtp
  6. smtp_settings:
  7. tls: true
  8. enable_starttls_auto: true
  9. address: "smtp.gmail.com"
  10. port: 587
  11. domain: "smtp.gmail.com" # 'your.domain.com' for GoogleApps
  12. authentication: :plain
  13. user_name: ""
  14. password: "your_password"@

After execute test email notification - fetched error "SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol".

David, maybe you install in your machine special tls plugin. How did you that?

RE: Error while sending email through Gmail. - Added by unisol solo about 2 years ago

"SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol".

help!

RE: Error while sending email through Gmail. - Added by unisol solo about 2 years ago

delivery_method: :smtp
smtp_settings:
address: smtp.gmail.com
port: 587
domain: substancelab.com
authentication: login
user_name: ""
password: passw0rd
enable_starttls_auto: true

WORK!!!

delete - tls: true

RE: Error while sending email through Gmail. - Added by David Díaz about 2 years ago

Hi, Aleksander Demidov.

Remove tls: true. You only need enable_starttls_auto: true to enable tls. And then remove quotes (", ") on address, domain and password. The gems that i've installed are posted above and i don't have any special tls gem.

Hope this help you.

RE: Error while sending email through Gmail. - Added by Aleksander Demidov about 2 years ago

Maybe, I use old version gem`s. But gemfile in redmine-2.0 write new version of my gems.
Gem list:

abstract (1.0.0)                                                                                                                     
action_mailer_tls (1.1.3)                                                                                                            
actionmailer (3.2.3, 3.1.0, 3.0.0, 2.3.14, 2.3.11, 2.3.5)                                                                            
actionpack (3.2.3, 3.1.0, 3.0.0, 2.3.14, 2.3.11, 2.3.5)                                                                              
activemodel (3.2.3, 3.1.0, 3.0.0)
activerecord (3.2.3, 3.1.0, 3.0.0, 2.3.14, 2.3.11, 2.3.5)
activeresource (3.2.3, 3.1.0, 3.0.0, 2.3.14, 2.3.11, 2.3.5)
activesupport (3.2.3, 3.1.0, 3.0.0, 2.3.14, 2.3.11, 2.3.5)
ambethia-smtp-tls (1.1.2)
arel (3.0.2, 2.2.1, 1.0.1)
bcrypt-ruby (3.0.1)
builder (3.0.0, 2.1.2)
bundler (1.1.3, 1.0.18)
capistrano (2.12.0)
cgi_multipart_eof_fix (2.5.0)
coderay (1.0.6)
daemon_controller (0.2.6)
daemons (1.1.8, 1.0.10)
dispatcher (0.0.1)
erubis (2.7.0, 2.6.6)
eventmachine (0.12.10)
fastercsv (1.5.5)
fastthread (1.0.7)
gem_plugin (0.2.3)
highline (1.6.12)
hike (1.2.1)
i18n (0.6.0, 0.4.2)
journey (1.0.3)
jruby-pageant (1.0.2)
json (1.7.3)
mail (2.4.4, 2.3.0, 2.2.19)
mime-types (1.18, 1.16)
mongrel (1.2.0.pre2, 1.1.5)
mongrel_cluster (1.0.5)
multi_json (1.3.5, 1.0.3)
mysql (2.8.1)
net-ldap (0.3.1)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.4.0)
net-ssh-gateway (1.1.0)
passenger (3.0.9)
pg (0.13.2)
polyglot (0.3.3, 0.3.2)
prototype-rails (3.2.1)
rack (1.4.1, 1.1.0)
rack-cache (1.2, 1.0.3)
rack-mount (0.8.3, 0.6.14)
rack-openid (1.3.1)
rack-ssl (1.3.2)
rack-test (0.6.1, 0.5.7)
rails (3.2.3, 3.1.0, 3.0.0, 2.3.14, 2.3.11)
railties (3.2.3, 3.1.0, 3.0.0)
rake (0.9.2.2, 0.9.2)
rdoc (3.12, 3.9.4, 2.4.2)
rmagick (2.13.1)
ruby-openid (2.1.8)
rubygems-update (1.8.24)
rubytree (0.8.2)
sprockets (2.1.3, 2.0.0)
sqlite3 (1.3.6)
thin (1.3.1)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33, 0.3.29)

My gemfile.lock (in redmine-2.0 directory):

GEM
  remote: http://rubygems.org/
  specs:
    actionmailer (3.2.3)
      actionpack (= 3.2.3)
      mail (~> 2.4.4)
    actionpack (3.2.3)
      activemodel (= 3.2.3)
      activesupport (= 3.2.3)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.1)
      rack (~> 1.4.0)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.1.2)
    activemodel (3.2.3)
      activesupport (= 3.2.3)
      builder (~> 3.0.0)
    activerecord (3.2.3)
      activemodel (= 3.2.3)
      activesupport (= 3.2.3)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activeresource (3.2.3)
      activemodel (= 3.2.3)
      activesupport (= 3.2.3)
    activesupport (3.2.3)
      i18n (~> 0.6)
      multi_json (~> 1.0)
    arel (3.0.2)
    builder (3.0.0)
    cgi_multipart_eof_fix (2.5.0)
    coderay (1.0.6)
    daemons (1.1.8)
    dispatcher (0.0.1)
    erubis (2.7.0)
    fastercsv (1.5.5)
    fastthread (1.0.7)
    gem_plugin (0.2.3)
    hike (1.2.1)
    i18n (0.6.0)
    journey (1.0.3)
    json (1.7.3)
    mail (2.4.4)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    metaclass (0.0.1)
    mime-types (1.18)
    mocha (0.11.4)
      metaclass (~> 0.0.1)
    mongrel (1.2.0.pre2)
      daemons (~> 1.0.10)
      gem_plugin (~> 0.2.3)
    multi_json (1.3.5)
    mysql (2.8.1)
    mysql2 (0.3.11)
    net-ldap (0.3.1)
    pg (0.13.2)
    polyglot (0.3.3)
    prototype-rails (3.2.1)
      rails (~> 3.2)
    rack (1.4.1)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-openid (1.3.1)
      rack (>= 1.1.0)
      ruby-openid (>= 2.1.8)
    rack-ssl (1.3.2)
      rack
    rack-test (0.6.1)
      rack (>= 1.0)
    rails (3.2.3)
      actionmailer (= 3.2.3)
      actionpack (= 3.2.3)
      activerecord (= 3.2.3)
      activeresource (= 3.2.3)
      activesupport (= 3.2.3)
      bundler (~> 1.0)
      railties (= 3.2.3)
    railties (3.2.3)
      actionpack (= 3.2.3)
      activesupport (= 3.2.3)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (~> 0.14.6)
    rake (0.9.2.2)
    rdoc (3.12)
      json (~> 1.4)
    rmagick (2.13.1)
    ruby-openid (2.1.8)
    shoulda (2.11.3)
    sprockets (2.1.3)
      hike (~> 1.2)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sqlite3 (1.3.6)
    thor (0.14.6)
    tilt (1.3.3)
    treetop (1.4.10)
      polyglot
      polyglot (>= 0.3.1)
    tzinfo (0.3.33)

PLATFORMS
  ruby

DEPENDENCIES
  activerecord-jdbcmysql-adapter
  activerecord-jdbcpostgresql-adapter
  activerecord-jdbcsqlite3-adapter
  builder
  cgi_multipart_eof_fix
  coderay (~> 1.0.6)
  dispatcher
  fastercsv (~> 1.5.0)
  fastthread
  i18n (~> 0.6.0)
  jruby-openssl
  mocha
  mongrel (= 1.2.0.pre2)
  mysql
  mysql2 (~> 0.3.11)
  net-ldap (~> 0.3.1)
  pg (>= 0.11.0)
  prototype-rails (= 3.2.1)
  rack-openid
  rails (= 3.2.3)
  rdoc (>= 2.4.2)
  rmagick (>= 2.0.0)
  ruby-openid (~> 2.1.4)
  shoulda (~> 2.11)
  sqlite3

My settings in configuration.yml:

production:
  delivery_method: :smtp
  smtp_settings:
    address: smtp.gmail.com
    port: 587
    domain: smtp.gmail.com
    authentication: :login
    user_name: "myusername@gmail.com" 
    password: mypassword
    enable_starttls_auto: true

After execute test notification mail, fetch error: "530 5.7.0 Must issue a STARTTLS command first. n19sm30590948bkv.14".
Why in you it work, but from my not work?

RE: Error while sending email through Gmail. - Added by Sungjin Kim almost 2 years ago

I have solved in Redmine 2.0

1. Don't install "action_mailer_optional_tls" plugin.
2. Copy gmail setting example in "configuration.example" into "configuration.xml"
IMPORTANT : Keep space and tab .

# 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: "your_email@gmail.com" 
#       password: "your_password" 

3. Remove "#" and # 'your.domain.com' for GoogleApps and "tls:true" and quotes in address and domain and password. Only remain quotes in user_name.
IMPORTANT : Keep space and tab .

production:
   email_delivery:
     delivery_method: :smtp
     smtp_settings:
       enable_starttls_auto: true
       address: "smtp.gmail.com" 
       port: 587
       domain: "smtp.gmail.com" 
       authentication: :plain
       user_name: "your_email@gmail.com" 
       password: "your_password" 

4. Set your Gmail setting
IMPORTANT : Keep space and tab .

production:
   email_delivery:
     delivery_method: :smtp
     smtp_settings:
       enable_starttls_auto: true
       address: smtp.gmail.com
       port: 587
       domain: smtp.gmail.com
       authentication: :plain
       user_name: "kskyj_test@gmail.com" 
       password: 123455

5. Have fun :0

RE: Error while sending email through Gmail. - Added by Plam Sim 7 months ago

It works perfect for Redmine 2.4.1 and Gmail SMTP method. I used the syntax described by Sungjin Kim. Thank you very much.

(1-9/9)