Redmine Gmail imap Rake script


I am new to Redmine, I am using Gmail for outbound email notifications and all is working Fine.

However I cannot get my head around the rake command to fetch emails from Gmail.

I have seen many examples but even cutting and pasting but modifying them still does work, I think the issue is with me and not grasping the rake command, I am using ubuntu Bitnami 14.04 virtual machine.

Can you clarify the structure of this command so I can test it.

/opt/bitnami/apps/redmine/htdocs/bin/rake I can see this is a valid path is this the rake program?

What is this section

-f /opt/bitnami/apps/redmine/htdocs/Rakefile there is no Rakefile so I created one using nano

Should the rakefile contain this redmine:email:receive_imap RAILS_ENV=“production” port=993 ssl=1 password=xxx project=vod835 tracker=errore allow_override=tracker,priority unknown_user=accept no_permission_check=1 ?

When I run this command on the console I get syntax error, unexpected “:” expecting end of input redmine:email:^receive_imap.

I added teh --trace command to the end

I have spend a considerable length of time looking for a solution but I believe that I am doing something wrong and the software is working fine.

Any pointers in this matter would be very helpful



Hi @steve_smith,

I’ve tried to reproduce the issue in a Redmine 3.3.1-0 virtual machine, but the /opt/bitnami/apps/redmine/htdocs/Rakefile is present. You shouldn’t have to create a Rakefile.

Can you give us more information about the version of the virtual machine you’re running and any additional steps you may have followed after starting the virtual machine?

Thank you for your kind cooperation.

Best regards,
Alvaro Recio

HI Alvaro

Sorry for the delay in getting back to you.

ubuntu 14.04 kernel 3.13.0
I think the problem is a lack of knowledge on how to get the string into a cronjob

I am using Gmail to send emails and this is working fine.

So I literally took the string that was on the forum changed the gmail details and ran it on the console and I would get the errors that I indicated in the original… I am not sure what I am doing wrong

So I took this code

*/30 * * * * redmineuser rake -f /path/to/redmine/appdir/Rakefile redmine:email:receive_imap RAILS_ENV=“production” password=xxx

I left the redmine user out, do I need to have a dedicated account for this to run.



Hi Alvaro,

I can see the Rakefile in the location mentioned, I modified the command to this

rake -f /opt/bitnami/apps/redmine/htdocs/Rakefile redmine:email:receive_imap RAILS_ENV=“production” password=xxxx I now have a different error,

Do I need to upgrade rake?

Gem::LoadError: You have already activated rake 10.4.2, but your Gemfile requires rake 11.3.0. Prepending bundle exec to your command may solve this.
/opt/bitnami/apps/redmine/htdocs/config/boot.rb:4:in <top (required)>' /opt/bitnami/apps/redmine/htdocs/config/application.rb:1:in <top (required)>’
/opt/bitnami/apps/redmine/htdocs/Rakefile:5:in <top (required)>' LoadError: cannot load such file -- bundler/setup /opt/bitnami/apps/redmine/htdocs/config/boot.rb:4:in <top (required)>’
/opt/bitnami/apps/redmine/htdocs/config/application.rb:1:in <top (required)>' /opt/bitnami/apps/redmine/htdocs/Rakefile:5:in <top (required)>’
(See full trace by running task with --trace)

Your issue is quite similar to mine awhile back. Try my solution at: Create update new issues via email and see if that works for you.

Hi @steve_smith,

Could you try the solution provided by @wthsia and confirm whether it works for you or not?

Best regards,
Alvaro Recio

HI, Slowly making progress,

New issue

I created what I believe to be a script based on wthsia information,

Please see below the script and the latest error

.sh file



cd /opt/bitnami/apps/redmine/htdocs/

bundle exec rake -f Rakefile redmine:email:receive_imap port=993 RAILS_ENV=“production” password=xxxx ssl=true project=domain tracker=Support unknown_user=create.

run ./

Now get this made sure that I had chmod 666 the .sh file as it initially would not run

rake aborted!
Psych::SyntaxError: (): did not find expected key while parsing a block mapping at line 16 column 5
/opt/bitnami/apps/redmine/htdocs/lib/redmine/configuration.rb:86:in load_from_yaml' /opt/bitnami/apps/redmine/htdocs/lib/redmine/configuration.rb:42:in load’
/opt/bitnami/apps/redmine/htdocs/lib/redmine/configuration.rb:67:in []' /opt/bitnami/apps/redmine/htdocs/lib/redmine/thumbnail.rb:25:in module:Thumbnail
/opt/bitnami/apps/redmine/htdocs/lib/redmine/thumbnail.rb:22:in <module:Redmine>' /opt/bitnami/apps/redmine/htdocs/lib/redmine/thumbnail.rb:21:in <top (required)>’
/opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport- require' /opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport- block in require’
/opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport- load_dependency' /opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport- require’
/opt/bitnami/apps/redmine/htdocs/lib/redmine.rb:48:in <top (required)>' /opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport- require’
/opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport- block in require' /opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport- load_dependency’
/opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport- require' /opt/bitnami/apps/redmine/htdocs/config/initializers/30-redmine.rb:6:in <top (required)>’
/opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport- load' /opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport- block in load’
/opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport- load_dependency' /opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport- load’
/opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/railties- block in load_config_initializer' /opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport- instrument’
/opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/railties- load_config_initializer' /opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/railties- block (2 levels) in class:Engine
/opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/railties- each' /opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/railties- block in class:Engine
/opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/railties- instance_exec' /opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/railties- run’
/opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/railties- block in run_initializers' /opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/railties- each’
/opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/railties- tsort_each_child' /opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/railties- run_initializers’
/opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/railties- initialize!' /opt/bitnami/apps/redmine/htdocs/config/environment.rb:14:in <top (required)>’
/opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport- require' /opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport- block in require’
/opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport- load_dependency' /opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport- require’
/opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/railties- require_environment!' /opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/railties- block in run_tasks_blocks’
/opt/bitnami/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/rake-11.3.0/exe/rake:27:in `<top (required)>’
Tasks: TOP => redmine:email:receive_imap => environment
(See full trace by running task with --trace)

try running the bundle exec command manually. So run “./use_redmine” to get a subshell. navigate to apps/redmine/htdocs/ and runt he bundle exec command with --trace. That may give you more info to troubleshoot.


I have tried the command that you suggested, however I am still getting this error with the --trace what code block mapping line 17 column 5 is this referring to

rake aborted!
Psych::SyntaxError: (): did not find expected key while parsing a block mapping at line 17 column 5

Hello @steve_smith,

Could you also check the YAML configuration file syntax? According to the error message, it seems it is a syntax error. Yaml files are very picky regarding tab and spaces characters. You can use a tool like to validate the syntax.


Thank you for your help,

I started with a Fresh VM and followed the same steps and used the same code and it is all working now, so I am not sure what I was doing incorrectly.

I just now need to figure out the layout to raise bugs etc from the email import for each project,

It seems to work well when replying to comments, am I correct in thinking that a user can email bugs directly to a project. Time for some more reading thanks again for your help.


Hi @steve_smith,

We are glad that you were able to fix the issue. Thanks to @wthsia for your help too, we appreciate it.

If you have any other question and you think we can help, please don’t hesitate to ask.

Best regards,
Alvaro Recio