Integrate Request Tracker and Exim4 on Ubuntu 10.04 LTS

This article will tell you how to integrate Request Tracker 3.8.7 and Exim4 on Ubuntu 10.04 LTS.

This integration allows Exim4 to automatically accept and route inbound emails to the correct queues in the RT config. The benefit to doing it this way is that you don’t need to touch the Exim4 config when adding new queues into RT.

You should start by deploying your RT instance as per my guide here.

Create a new file /etc/exim4/conf.d/main/10_request-tracker3 and enter the following:

QUEUENAME_QUERY   = \
SELECT Name FROM Queues WHERE  \
CorrespondAddress =  '${quote_mysql:$local_part}@${quote_mysql:$domain}' \
AND  Disabled = '0'
hide mysql_servers = $DBHOST/$DBNAME/$DBUSER/$DBPASSWORD
domainlist rt3_domains = $DOMAINLIST #domains we accept emails for; separate multiples with a colon
RT3_URL = http://{IP Address of host}/rt/

You will need to replace the $**** values with your configuration information.

Create a new file /etc/exim4/conf.d/router/310_request_tracker3 and enter the following:

request_tracker3:
 debug_print = "R: request_tracker3 for \
 $local_part$local_part_suffix@$domain \
 (calling ${substr_1:${if eq{$local_part_suffix}{}\
 {-correspond}\
 {$local_part_suffix}}})"
 driver = redirect
 domains = +rt3_domains
 local_parts = mysql; QUEUENAME_QUERY
 local_part_suffix = -comment
 local_part_suffix_optional
 pipe_transport = request_tracker3_pipe
 data = "|/usr/bin/rt-mailgate \
 --queue \"${lookup mysql{QUEUENAME_QUERY}}\" \
 --action ${substr_1:${if eq{$local_part_suffix}{}\
 {-correspond}\
 {$local_part_suffix}}} \
 --url RT3_URL"
 user = www-data

Create a new file /etc/exim4/conf.d/transport/30_request-tracker3 and enter the following:

request_tracker3_pipe:
debug_print = "T: request_tracker3_pipe for $local_part@$domain"
driver = pipe
return_fail_output
allow_commands = /usr/bin/rt-mailgate

Once you have completed the customised exim4 files you should tell exim4 to regenerate its configuration. `update-exim4.conf`

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: