Receiving Emails in Redmine with GMail on Dreamhost

Setting up Redmine to create issues from emails, the way I did it, mostly involved getting a cron job running to rake redmine:email:receive_imap. The basic steps are:

    1. Create a GMail Account
    2. Add a script to run at intervals (I am running it every 30 – */30 * * * *

I created shell script in it’s own file that reads like this:

#!/bin/bash
/home/xxxx/.gems/bin/rake -f ~/xxxx/Rakefile redmine:email:receive_imap RAILS_ENV="production" host=imap.gmail.com ssl=SSL port=993 username=xxxx@gmail.com password=xxxx project=xxx tracker=bug priority=Immediate allow_override=project,tracker,priority --trace

One thing that hung me up was that for ruby gems to be in the path in the cron execution context, you’re crontab needs to look like this:

*/30 * * * * . /etc/profile && /path/to/script.sh

Without the “. /etc profile” part, your script won’t know what the hell a “rake” is.

I can’t get the “assigned_to” default to work, but I’m happy with it running properly for the time being.

One Reply to “Receiving Emails in Redmine with GMail on Dreamhost”

  1. root@71a393799064:~# nano mail.sh
    root@71a393799064:~# ./mail.sh
    W, [2023-09-19T12:59:40.148279 #346] WARN — : Creating scope :system. Overwriting existing method Enumeration.system.
    rake aborted!
    Net::IMAP::BadResponseError: Command received in Invalid state.
    /usr/src/redmine/lib/redmine/imap.rb:37:in `check’
    /usr/src/redmine/lib/tasks/email.rake:121:in `block (4 levels) in ‘
    /usr/src/redmine/app/models/mailer.rb:648:in `with_synched_deliveries’
    /usr/src/redmine/lib/tasks/email.rake:120:in `block (3 levels) in ‘
    Tasks: TOP => redmine:email:receive_imap
    (See full trace by running task with –trace)
    ./mail.sh: line 4: –trace: command not found

    I’m getting this error. If you have any idea please help me to finish this.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.