User Tools

Site Tools


linux:configure_redmine_email

Configure Redmine Email

This page shows how to configure Redmine to allow issue creation and modification though email. That is, configure it so that you can send emails to a specific email account to create and update Redmine issues.

Prerequisites

For this guide, we used a machine running the following:

  • Redmine 2.1 32-bit.
  • Exchange Server 2007.
  • Running on CentOS 6 32-bit (Install CentOS 6)
  • An email account 'redmine@example.com' on the Exchange Server.
  • Redmine runs as user 'root' on the server.
  • The Redmine installation is in /opt/redmine-2.1.0-0 and /opt/redmine is a symlink to /opt/redmine-2.1.0-0.

Crontab

Run the command

crontab -e

Add the following (change PASSWORD to be what ever the password is for the account redmine@example.com)

*/2 * * * * cd /opt/redmine/apps/redmine/htdocs; rake -s redmine:email:receive_imap RAILS_ENV="production" host=mail.example.com port=993 ssl=1 username=redmine@example.com password=PASSWORD folder=Inbox move_on_success=redmine_success move_on_failure=redmine_failure allow_override=project,tracker,status,priority,category,assigned_to,fixed_version,start_date,due_date,estimated_hours,done_ratio

SSL

In modern versions of Redmine (2.3+), Ruby 1.9 is used. In this version, you may find that the 'email sync' command above does not work and you get an error message about SSL certificates.

The solution is to create a file in the /data/bitnami/redmine/apps/redmine/htdocs/config/initializers directory with the text below. We call the file bypass_ssl_verification.rb but the name is not actually important as all files in that directory get run (regardless of name).

cat << EOF >> /data/bitnami/redmine/apps/redmine/htdocs/config/initializers/bypass_ssl_verification.rb
require 'openssl'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
EOF

Trackers

When trying to specify a tracker in an email to redmine, bear in mind that certain trackers will require extra fields as mandatory. For example, in the wsxopsreferralsystem project, to use the

Tracker: Reportable Complaint

line, you also need to include the

Date of Complaint: 2013-05-05

line as 'Date of Complaint' is a mandatory field for that tracker.

Bug Fix

For version 2.1 there is a bug that causes redmine to ignore emails that try to set/update custom fields that are of type 'list'. The fix in Redmine 2.1 is to update four files.

The information on the modifications can be found here.

Note: When applying the modifications, replace PostgreSQL with MySQL and replace postgresql with mysql as we use MySQL for redmine.

Example - New Item

An example email could run like the email shown below. More info [http://www.redmine.org/projects/redmine/wiki/RedmineReceivingEmails#How-it-works here].

DO NOT USE TABS

To: redmine@example.com
Subject: INSERT_WHAT_YOU_WANT_TO_CALL_THE_ISSUE
You can put in many lines of text here for the main info section
As you can see
This is the third line
Project: myproject
Tracker: mytracker
Assignee: John Smith
Policy Number: 123456
Referral Raised By: John Smith
Priority: Low
Product: myproduct

Example - Update Item

When updating items, the secret is in the Subject. You have to format it like so 'Re: [blahblah #123]' where 123 is replaced with the issue number and you can put any text you want instead of blahblah - redmine ignores that text. In fact, you can just put no text at all in place of blahblah. As an example.

DO NOT USE TABS

To: redmine@example.com
Subject: Re: [blahblah #123]
You can put in many lines of text here for the main info section
As you can see
This is the third line
Project: myproject
Tracker: mytracker
Assignee: John Smith
Policy Number: 123456
Referral Raised By: John Smith
Priority: Low
Product: myproduct
linux/configure_redmine_email.txt · Last modified: by 127.0.0.1