Setting up Redmine to receive emails tru IMAP

Prepare the IMAP folders

Create the e.g. ‘redmineseen’ and ‘redminefailed’ folders on the imap account that’s going to receive messages. Send a test email to that mailbox, make sure it’s still flagged as UNREAD (you can mark read/unread with thunderbird).

Using the rake command line

First, check that the command line works,

cd /usr/src/redmine/
rake redmine:email:receive_imap \
    RAILS_ENV=production \
    host=IMAP_SERVER port=993 ssl=true \
    username=TESTACCOUNT password="XXXX" \
    move_on_success=redmineseen move_on_failure=redminefailed \
    project=test-project tracker=support \
    unknown_user=accept no_permission_check=1

note tracker=support – tickets get created as “support” request note unknown_user=accept no_permission_check=1 – unknown emails are allowed to create tickets check that the ticket get’s created and the message moved to the e.g. ‘redmineseen’ mailbox. Then enable it e.g. this crontab,

Enabling the shit with a cron job

crontab -u redmine -e
#su - redmine
#crontab -e

(copy/paste most of the vars defined in `env`, at least the bundle version and the PATH)

* * * * * /root/bin/rakefetch.bash >/dev/null 2>&1 || echo RAKE FETCH FAILED

Note that you’ll have to copy lots of env variables to the rakefetch script to make it work.

TOSORT

Eventually add an option in mailhandler to disable server certificate verification,

cd extra/mail_handler/
cp rdm-mailhandler.rb rdm-mailhandler.rb.dist
vi rdm-mailhandler.rb

grep OpenSSL::SSL::VERIFY_PEER

rake redmine:email:receive_imap RAILS_ENV="production" host=IMAP_SERVER port=993 username=TESTACCOUNT password="PASSWORD" ssl=true move_on_success=redmineseen move_on_failure=redminefailed project=test-project unknown_user=accept no_permission_check=1

tracker=bug \\
allow_override=tracker,priority

make sure the mail is unread on the imap resource…

Validation

test that everything works:

References


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun