luismaia/redmine_email_fetcher

Error on fetch with IMAP without SSL

maiconzucco opened this issue · 2 comments

Hi,

I configured the plugin whit IMAP on port 143 without SSL and received the error below:

bitnami@tijuca:/opt/bitnami/apps/redmine/htdocs$ rake redmine:plugins:email_fetcher:fetch_all_emails RAILS_ENV=production
Loading Rails environment for Resque
rake aborted!
SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol
/opt/bitnami/apps/redmine/htdocs/lib/redmine/imap.rb:29:in new' /opt/bitnami/apps/redmine/htdocs/lib/redmine/imap.rb:29:incheck'
/opt/bitnami/apps/redmine/htdocs/plugins/redmine_email_fetcher/app/models/email_fetches.rb:91:in fetch_emails' /opt/bitnami/apps/redmine/htdocs/plugins/redmine_email_fetcher/app/models/email_fetches.rb:7:intest_and_fetch_emails'
/opt/bitnami/apps/redmine/htdocs/plugins/redmine_email_fetcher/app/models/email_configuration.rb:44:in block in fetch_all_emails' /opt/bitnami/apps/redmine/htdocs/plugins/redmine_email_fetcher/app/models/email_configuration.rb:43:infetch_all_emails'
/opt/bitnami/apps/redmine/htdocs/plugins/redmine_email_fetcher/lib/tasks/email_fetcher.rake:15:in block (4 levels) in <top (required)>' Tasks: TOP => redmine:plugins:email_fetcher:fetch_all_emails (See full trace by running task with --trace) bitnami@tijuca:/opt/bitnami/apps/redmine/htdocs$ rake redmine:plugins:email_fetcher:fetch_all_emails RAILS_ENV=production --trace Loading Rails environment for Resque ** Invoke redmine:plugins:email_fetcher:fetch_all_emails (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute redmine:plugins:email_fetcher:fetch_all_emails rake aborted! SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol /opt/bitnami/ruby/lib/ruby/1.9.1/net/imap.rb:1439:inconnect'
/opt/bitnami/ruby/lib/ruby/1.9.1/net/imap.rb:1439:in start_tls_session' /opt/bitnami/ruby/lib/ruby/1.9.1/net/imap.rb:1036:ininitialize'
/opt/bitnami/apps/redmine/htdocs/lib/redmine/imap.rb:29:in new' /opt/bitnami/apps/redmine/htdocs/lib/redmine/imap.rb:29:incheck'
/opt/bitnami/apps/redmine/htdocs/plugins/redmine_email_fetcher/app/models/email_fetches.rb:91:in fetch_emails' /opt/bitnami/apps/redmine/htdocs/plugins/redmine_email_fetcher/app/models/email_fetches.rb:7:intest_and_fetch_emails'
/opt/bitnami/apps/redmine/htdocs/plugins/redmine_email_fetcher/app/models/email_configuration.rb:44:in block in fetch_all_emails' /opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.19/lib/active_record/relation/delegation.rb:6:ineach'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.19/lib/active_record/relation/delegation.rb:6:in each' /opt/bitnami/apps/redmine/htdocs/plugins/redmine_email_fetcher/app/models/email_configuration.rb:43:infetch_all_emails'
/opt/bitnami/apps/redmine/htdocs/plugins/redmine_email_fetcher/lib/tasks/email_fetcher.rake:15:in block (4 levels) in <top (required)>' /opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/task.rb:236:incall'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/task.rb:236:in block in execute' /opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/task.rb:231:ineach'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/task.rb:231:in execute' /opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/task.rb:175:inblock in invoke_with_call_chain'
/opt/bitnami/ruby/lib/ruby/1.9.1/monitor.rb:211:in mon_synchronize' /opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/task.rb:168:ininvoke_with_call_chain'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/task.rb:161:in invoke' /opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/application.rb:149:ininvoke_task'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/application.rb:106:in block (2 levels) in top_level' /opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/application.rb:106:ineach'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/application.rb:106:in block in top_level' /opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/application.rb:115:inrun_with_threads'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/application.rb:100:in top_level' /opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/application.rb:78:inblock in run'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/application.rb:165:in standard_exception_handling' /opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/application.rb:75:inrun'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.1/bin/rake:33:in <top (required)>' /opt/bitnami/ruby/bin/rake:23:inload'
/opt/bitnami/ruby/bin/rake:23:in `

'
Tasks: TOP => redmine:plugins:email_fetcher:fetch_all_emails

Below my configuration:

id: 1
configuration_type: imap
host: 127.0.0.1
port: 143
ssl: 0
username: my_user
password: my_pass
folder: INBOX
move_on_success:
move_on_failure:
delete_unprocessed: 0
apop: 0
unknown_user: create
no_account_notice: 1
no_permission_check: 1
default_group:
project_id: 2
tracker_id: 3
category:
priority:
allow_override: priority
last_fetch_at:
flg_active: 1

Any idea?

Thanks.

@maiconzucco , from the log I can tell that the problem is happening in Redmine imap library, probably due to an issue I found (and corrected) in my code.

If after updating the code the error persists, and since this specific error can be caused by various reasons, send me the output of each of these commands in rails console:

require 'net/imap' (optional)

host = '127.0.0.1'
port = '143'
ssl = 0
folder = 'INBOX'

imap = Net::IMAP.new(host, port, ssl)
imap.login('my_user', 'my_pass')
imap.select(folder)

Thanks a lot!

Hi,

Thanks for your answer.
After the alteration, the fetch works fine.

Thanks @luismaia.