Defect #10528

Error with rake redmine:email:receive_imap and cram-md5

Added by Mezz Anon about 5 years ago. Updated about 5 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Email receiving
Target version:Candidate for next minor release
Resolution: Affected version:

Description

rake -f ./Rakefile redmine:email:receive_imap RAILS_ENV="production" host=<host> username=<username> password=<password> port=<port> ssl=1 --trace
(in /srv/www/htdocs/redmine/)
** Invoke redmine:email:receive_imap (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine:email:receive_imap
rake aborted!
Auth method not enabled
/usr/lib/ruby/1.8/net/imap.rb:981:in `pick_up_tagged_response'
/usr/lib/ruby/1.8/net/imap.rb:974:in `get_tagged_response'
/usr/lib/ruby/1.8/net/imap.rb:1032:in `send_command'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/1.8/net/imap.rb:1017:in `send_command'
/usr/lib/ruby/1.8/net/imap.rb:378:in `login'
/srv/www/htdocs/redmine/lib/redmine/imap.rb:30:in `check'
/srv/www/htdocs/redmine/lib/tasks/email.rake:134
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

The cause is /lib/redmine/imap.rb:

imap = Net::IMAP.new(host, port, ssl)
imap.login('LOGIN', imap_options[:username], imap_options[:password]) unless imap_options[:username].nil?

The solution is to change imap.login with imap.authenticate in /lib/redmine/imab.rb and take the auth type as a parameter:

      folder = imap_options[:folder] || 'INBOX'
 +    auth = imap_options[:auth] || 'LOGIN'

      imap = Net::IMAP.new(host, port, ssl)
 -    imap.login('LOGIN', imap_options[:username], imap_options[:password]) unless imap_options[:username].nil?
 +    imap.authenticate(imap_options[:auth], imap_options[:username], imap_options[:password]) unless imap_options[:username].nil?

Also need to modify /lib/tasks/email.rb:

       folder=FOLDER            IMAP folder to read (default: INBOX)
 +     auth=AUTH                IMAP authentication type (default: LOGIN)

       :folder => ENV['folder'],
 +     :auth => ENV['auth'],
       :move_on_success => ENV['move_on_success'],

This now runs succesfully:

rake -f ./Rakefile redmine:email:receive_imap RAILS_ENV="production" host=<host> username=<username> password=<password> port=<port> ssl=1 auth=CRAM-MD5 --trace

History

#1 Updated by Etienne Massip about 5 years ago

  • Category set to Email receiving
  • Target version set to Candidate for next minor release

Also available in: Atom PDF