A Personal Approach To RT With Gmail

Request Tracker is open source ticket tracking software typically discussed as enterprise software used by various types of businesses and organizations. There are plenty of diverse examples of how large and small businesses use RT to manage everything from help desk requests to security incident response to software bug tracking. But at Best Practical, we also hear from users who deploy RT on a much smaller scale, sometimes only for an individual user.

Being the type of person who finds it thrilling to spin up a new Digital Ocean droplet and see what open source tool I can use for my own personal needs, I also decided to try running a personal RT for myself. I also happen to work for Best Practical Solutions, so I am always asking myself what the software I make is capable of.

RT And Email

RT is built off of email. Although strictly speaking email isn't necessary for tracking tickets, you could solely use the web UI with no email alerts or ticket creation from email, for my use case I wanted to incorporate my personal email with RT. Luckily I have my own domain name that I use for personal email.

In my experience most companies will provision many email accounts for their RT to use with addresses like “support@example.com” and “sales@example.com” for example. These would be two separate inboxes that when emailed would create a new ticket in RT queues “Support” or “Sales”. Simple!

If you're like me though you're not interested in paying for the Gmail subscription for every single RT queue you want to make (around $6 a month per email).

Email Aliasing To The Rescue

G Suite allows you to set aliases for your inbox, so for my case I only paid for the “craig@example.com” but now I can point many email aliases to my single inbox. For this example I created two aliases “craig-billing@example.com”, “craig-travel@example.com”, and “craigs-rubber-duck-collection@example.com”.


Setting Up Gmail To Work With RT

As part of the set-up described here, you need to enable “less secure apps” with your Gmail account in order to fetch mail from your inbox. Once things are set up, you can keep your Gmail inbox as your personal inbox and use it with RT. Realistically we do not want a ticket for every email that comes into our inbox, we only want a subset of these emails to be preserved on our pristine RT life tracker!

Luckily for us Google makes it simple to automatically separate the junk emails and the worth-saving-in-RT emails through tags and filters. First let's go and create a Gmail tag called “RT”. This is where we will put the emails that we want to have RT open a ticket for. We don't want to do this manually though, so we can create a new Gmail filter.

We want the filter to check for our two email aliases as the “To” parameter and if one of them is indeed the value for the “To” parameter, go ahead and add one of our Gmail tags “RT/Travel” or “RT/Billing”.

Screen Shot 2019-04-24 at 7.02.59 AM.png

Now that Gmail is all set let's hop onto our RT server and set-up our email fetching.

Getmail And rt-mailgate

We will use Getmail to fetch out emails from our RT inbox and pipe them to RT.

Getmail parameters can be stored in a config file and I will put mine at "/opt/rt4/etc/getmailrc-travel" with the following content: (Note you need one file for each email alias)

    type      = SimpleIMAPSSLRetriever
    server    = imap.gmail.com
    username  = craig@mydomain.com
    password  = supersecret
    mailboxes = ("RT/Travel",)

    type      = MDA_external
    path      = /opt/rt4/bin/rt-mailgate
    arguments = ("--url", "http://rt.mydomain.com", "--queue", "
", "--action", "correspond",) [options] read_all = false delete = true message_log = /var/log/getmail.log

Now lets break down the important parts here:

mailboxes = ("RT/Travel",)

This line tells Getmail that we only want to check the “RT/Travel” mailbox. In our case since we are using Gmail it is the “RT/Travel” tags mailbox.

type      = MDA_external
path      = /opt/rt4/bin/rt-mailgate
arguments = ("--url", "http://rt.mydomain.com", "--queue", "Travel", "--action", "correspond")

We use the MDA_external option and the rt-mailgate utility to send the email over to RT. There it will create a ticket or add to an existing ticket in the “Travel” queue.

Finally we can create a cron job for fetching our email regularly:

*/1 * * * * /usr/bin/getmail --rcfile /opt/rt4/etc/getmailrc-travel --rcfile /opt/rt4/etc/getmailrc-biling

Now we should all be set to track all the important things in our life!


The configuration described here works well for personal use, but there are some limitations that require changes to scale for business use. But if you’re thinking about setting up your own RT for personal use, it’s a simple way to automatically route some email to your RT life tracker.

Share this post: