undefined method `match' for nil:NilClass in mail_handler.rb:132

Added by Bastian Lemke over 5 years ago

I try to generate redmine tickets from an IMAP inbox. The login to the IMAP server can be established, but whenever an unread mail is in the inbox, I get the following error:

rake aborted!
undefined method `match' for nil:NilClass
/opt/redmine-2.0.3/app/models/mail_handler.rb:132:in `dispatch'
/opt/redmine-2.0.3/app/models/mail_handler.rb:113:in `receive'
...

I used 'receive_imap' before, but now I had to switch to another mailserver (SSL is required, with a self-signed certificate).

Is this a configuration problem, or a redmine bug? Perhaps, the self-signed certificate is causing problems ...
How can I fix this?

My configuration:

Ubuntu 12.04.1 LTS (x86_64)
mysql Ver 14.14 Distrib 5.5.24

Environment:
Redmine version 2.0.3.stable
Ruby version 1.8.7 (x86_64-linux)
Rails version 3.2.6
Environment production
Database adapter MySQL
Redmine plugins:
redmine_knowledgebase 2.1.0
redmine_lightbox 0.0.1
redmine_monitoring_controlling 0.1.1
redmine_mylyn_connector 2.8.2.stable

Thank you for your help...

Replies (5)

RE: undefined method `match' for nil:NilClass in mail_handler.rb:132 - Added by Nabil Faouzi about 5 years ago

Hello,

Have you resolve this issue? I have the same problem when i want to receive pop3 email :
In the redmine directory i use this simple syntax:

rake redmine:email:receive_pop3 host=POP3SERVER port=110 username=account@xxx.fr adress password=XXXXX RAILS_ENV=production --trace
** Invoke redmine:email:receive_pop3 (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine:email:receive_pop3
rake aborted!
undefined method `match' for nil:NilClass
/var/www/redmine/redmine-2.1.0/app/models/mail_handler.rb:135:in `dispatch'
/var/www/redmine/redmine-2.1.0/app/models/mail_handler.rb:116:in `receive'
/usr/local/lib/ruby/gems/1.9.1/gems/actionmailer-3.2.8/lib/action_mailer/base.rb:404:in `block in receive'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `block in instrument'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20

Environment:
  CentOS Linux                             release 6.0 (Final)
  Redmine version                          2.1.0.stable
  Ruby version                             1.9.3 (x86_64-linux)
  Rails version                            3.2.8
  Environment                              production
  Database adapter                         PostgreSQL
Redmine plugins:
  redmine_inline_attach_screenshot         0.3.5
  redmine_logs                             0.0.4
  redmine_monitoring_controlling           0.1.1
  redmine_theme_changer                    0.1.0
  redmine_user_issues                      0.0.2
  redmine_work_time                        0.2.6

Note: I don't use ssl and this issue don't reproduce with another pop3 account (the configuration of this account for the test is the same than the production account)

I'm very impatient to read you

RE: undefined method `match' for nil:NilClass in mail_handler.rb:132 - Added by Jürgen Hörmann about 5 years ago

I get the same issue on Redmine 2.1

I can send mail notifications through GMail, I can login into IMAP over SSL and mails get flagged as read, but the import of new mails fails with the same error:

rake -f /var/www/clients/client1/web11/redmine/Rakefile redmine:email:receive_imap RAILS_ENV="production" host=imap.gmail.com \
ssl=1 port=993 username=XXX password=XXX folder=Labor move_on_success="[Google Mail]/All Mail" \
move_on_failure="[Google Mail]/All Mail" tracker=support project=support allow_override=tracker,project --trace

Output:
** Invoke redmine:email:receive_imap (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine:email:receive_imap
rake aborted!
undefined method `match' for nil:NilClass
/var/www/clients/client1/web11/redmine/app/models/mail_handler.rb:135:in `dispatch'
/var/www/clients/client1/web11/redmine/app/models/mail_handler.rb:116:in `receive'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionmailer-3.2.8/lib/action_mailer/base.rb:404:in `block in receive'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `block in instrument'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `instrument'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionmailer-3.2.8/lib/action_mailer/base.rb:401:in `receive'
/var/www/clients/client1/web11/redmine/app/models/mail_handler.rb:44:in `receive'
/var/www/clients/client1/web11/redmine/lib/redmine/imap.rb:35:in `block in check'
/var/www/clients/client1/web11/redmine/lib/redmine/imap.rb:32:in `each'
/var/www/clients/client1/web11/redmine/lib/redmine/imap.rb:32:in `check'
/var/www/clients/client1/web11/redmine/lib/tasks/email.rake:133:in `block (3 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/rake:19:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/rake:19:in `<main>'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => redmine:email:receive_imap

RE: undefined method `match' for nil:NilClass in mail_handler.rb:132 - Added by Jürgen Hörmann about 5 years ago

Did anybody of you find a solution or workaround for this?

Would be glad if you could help me with this issue.

RE: undefined method `match' for nil:NilClass in mail_handler.rb:132 - Added by Jürgen Hörmann about 5 years ago

I'm glad to tell that Jean-Philippe fixed it in commit 10850

export the trunk to your project folder and this bug will disappear.

svn export --force http://svn.redmine.org/redmine/trunk/ your-redmine-folder

(1-5/5)