Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

IMAP and faster email-to-ticket with IDLE (for GMail)

Our business relies on an existing GMail account, and we also want to have a record of the messages stayed in the mailbox, so piping is not an option for us. I've set up OSTicket to poll the Gmail Inbox every 5 minutes with cron, but not very satisfying with the delay.

Found a Python script that can camp on GMail IMAP with IDLE mode, modified it to work with Python3 and to post emails to OSTicket's API:

I have it currently running as a service with Upstart. Have been working fine for a day. A few things I found:
- the script only checks for "unread/unseen" emails (and make them read/seen), it will leave the messages in Inbox
- OSTicket is smart enough to recognize duplicate emails, so I can mark the messages as "unread" for debugging/testing, the script will post the same emails again, and OSTicket will just ignore them.
- I also set OSTicket to poll GMail every 30 minutes and move the emails to a different folder/label. Of course, OSTicket will ignore the already retrieved emails, but it does clean up the mailbox and serve as a fallback in case  the Python script fails.

Just a side note, we were setting up Support Desk with Salesforce, and boys, it sucks so much. The GUI is so clunky, they can't sort the lists properly, it can indicate if a case has unread email, but it can't clear them automatically once read. It displays only the list of email subject, not showing them all out nicely. Most possible customizations will have to go through painful business processes, and custom development is next to impossible.

Thanks so much for the awesome OSTicket, I've been able to customize it a lot to our needs. Since I'm likely to support it myself (as a full-stack dev) instead of buying support, I guess I can contribute back by sharing my experience (and hopefully some development work soon).

it's not the software that's free; it's you


  • Does that mean you're downloading every email twice?
    Would be more efficient to move the messages with the python script as well, then turn off polling in osTicket, have the script just glob everything in the inbox.

    Other than that, awesome! Thanks for sharing!
  • Basically yes, I'm downloading every email twice. Even if the Python script is stable after further testing, I'll probably leave the setup that way so that I still have OSTicket polling as a fallback, in case the script goes wrong (Murphy Law!). Downloading the emails twice is a tiny cost comparing to disrupting business if the script goes wrong without OSTicket polling as a safety net. We have phones, tablets, desktop clients already downloading the same emails more than twice, this is nothing :-)

    I might add the options to move/delete messages to the Python script at some point, mirroring the options in OSTicket, maybe a little later.

Sign In or Register to comment.