Redmine收不到邮件

Redmine not receiving emails

请帮忙。

我想在 Redmine 4.1.1 中设置一个电子邮件阅读。 这是我在 CLI 中执行的代码:

bundle exec rake -f Rakefile --silent redmine:email:receive_imap RAILS_ENV="production" host=outlook.office365.com port=993 username=user@domain.com password=PASSWORD ssl=1 project=mars-test-do-not-delete folder=main move_on_success=completed move_on_failure=failed no_permission_check=1 unknown_user=accept no_account_notice=1 --trace

但是我在执行代码时得到了这个输出:

** Invoke redmine:email:receive_imap (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine:email:receive_imap
rake aborted!
NameError: uninitialized constant Redmine::IMAP
/home/seven/redmine/lib/tasks/email.rake:121:in `block (4 levels) in <top (required)>'
/home/seven/redmine/app/models/mailer.rb:630:in `with_synched_deliveries'
/home/seven/redmine/lib/tasks/email.rake:120:in `block (3 levels) in <top (required)>'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `block in execute'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `each'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `execute'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/task.rb:188:in `invoke'
Tasks: TOP => redmine:email:receive_imap

这只是输出的一半。

有什么想法吗?建议?任何:)

SMTP 工作没有任何问题。我正在使用 Exchange MS 服务器发送电子邮件。

谢谢。


作为更新: 我设置了一个新服务器 ubuntu 20.04 LTS 安装红矿4.0.6 Ruby 2.5.0 耙子 13.0.1

现在当我运行:

rake -f Rakefile --silent redmine:email:receive_imap RAILS_ENV="production" host=outlook.office365.com port=993 username=EMAIL_USER password=PASSWORD ssl=true project=mars-test-do-not-delete folder=main move_on_success=processed move_on_failure=failed no_permission_check=1 unknown_user=accept 1 > /dev/null

我明白了:

Your Gemfile lists the gem redmine_crm (>= 0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once.
While it's not a problem now, it could cause errors if you change the version of one of them later.
rake aborted!
NameError: uninitialized constant Redmine::IMAP
/home/seven/redmine/lib/tasks/email.rake:121:in `block (4 levels) in <top (required)>'
/home/seven/redmine/app/models/mailer.rb:612:in `with_synched_deliveries'
/home/seven/redmine/lib/tasks/email.rake:120:in `block (3 levels) in <top (required)>'
/home/seven/.rvm/gems/ruby-2.5.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
/home/seven/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:24:in `eval'
/home/seven/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:24:in `<main>'
Tasks: TOP => redmine:email:receive_imap
(See full trace by running task with --trace)

我确实检查了 redmine_crm,令我惊讶的是,在 Gemfile 中我只有一个对它的引用,所以我不完全理解为什么会出现此错误;/

我发现了问题。

在文件中:

/ROOT_PATH_TO_REDMINE/lib/tasks/email.rake

我需要在文件的顶部添加一行:

require 'redmine/imap.rb'

问题解决了。