I'm working on a IT service desk system and I'm trying to figure out how to raise tickets via an email or add comments to existing tickets via email replies. For example something like the JIRA Service desk where customers can open and work on requests from the comfort of their email inboxes.

Currently I have a system where by users must log in to raise a ticket or add comments. The system has a main table called tickets with fields such as id, title, description, user_id etc and another table called comments.

How can you configure a system to also accept tickets to be raised via email?

  1. How would the application intercept the email
  2. Check the email from address and if it does not exist in the users table then create a new user.
  3. Extract the subject of the email which could become the ticket title
  4. Extract the body of the email which would become the description.

If the user decides to reply to the an existing ticket via email then:

  1. How would you do the same above but also ensure the comments are added to the right ticket?

Any help, tips and guidance appreciated.


I believe Sendgrid and other mail services support webhooks. It would be much easier if your email converted to an HTTP request before hitting your systems.

Update: here’s a link. They’ll parse incoming email for you and POST it. https://sendgrid.com/docs/API_Reference/Webhooks/inbound_email.html


Essentially you have laid out the process.

Make a windows service or cron job which checks your support@mycompany.com email address every 10min and sorts through the mail creating tickets.

Email the customer back with a "Your Ticket Number is :" in the subject line. When they reply parse the ticket number out of the subject so you know what ticket to append the message to

  • Is there any code examples on how to read emails in c# from an outlook email address? Also how could you ensure that a malicious user doesn't change the ticket number and have their comment inserted into someone else ticket? Perhaps check against both the ticket id and the email address i suppose. – adam78 Oct 7 '17 at 14:46
  • see this answer : stackoverflow.com/questions/865267/… – Ewan Oct 7 '17 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.