2-way Email Sync for Zammad

(Moved from https://github.com/zammad/zammad/issues/1965)

Hello!

I would like to start a discussion on my work to add a new feature extension to Zammad. My team is super excited about Zammad and would love to make it even better with a few enhancements.

Using this to document the proposed changes and ask for help and guidance from others that may know the codebase better at the moment.

I would like to add 2 way email sync. This means that messages sent from Zammad are also placed in the Sent folder on IMAP and messages sent from IMAP (any email client) are appended to the relevant ticket in Zammad (both historically when first importing an IMAP mailbox and going forward). In the absence of a mobile version of Zammad, being able to reply from any client and having the reply appear and be properly tracked in Zammad would be awesome. Zammad can then continue to do what its good at and set rules on closing tickets, tracking responses, and making sure emails donā€™t fall through the cracks. This feature can easily benefit any user of the email channel and does not change any existing behaviorā€¦ it only adds new capabilities to be able to use any email client with Zammad and have them work seamlessly together.

Proposed Enhancements

  • 2 way email sync (allow replies both from zammad and from any mail client)
    • Have Zammad place messages it sends in the sent box on imap (easy)
    • Make sure Zammad sets the ā€œrepliedā€ flag on messages it sends replies on (easy)
    • Make sure sent messages properly set the references and in-reply-to headers (easy, does this already happen?)
    • Allow Zammad to also view the sent box to pull in any messages that are part of a thread into a ticket (relatively simple, just requires matching messages by the ā€œreferencesā€ or ā€œin reply toā€ headers, this will be the most involved step, anyone have a good idea how to make this elegant?)

Excited to hear otherā€™s thoughts, suggestions, and guidance.

1 Like

Well on my way to making this work. Have it working seamlessly in one direction (anything sent from any email client is now being logged in zammad). Itā€™s quite slick and makes it easy to reply to tickets on the go (from any email app)! Iā€™m sure you will love it.

Working now on adding messages sent from zammad (either via smtp or via sendmail) to the IMAP Sent folder. This is to make sure things are properly logged in one source of truth and can always we re-imported.

This requires a bit more plumbing in that the sent folder should be configurable in the initial settings and the SMTP and SENDMAIL channel drivers in app/models/channel/driver/ need to know which channel invoked them (Some of this might be present in the options param) so they can grab the setting and append the mail using the IMAP driver. This may also mean that connection to imap should be pulled out into its own function. Ruby is not my first language so Iā€™m learning as we go and making good progress.

What is the best way to get support from the core team (willing to pay/provide a bounty/etc.)? Very excited to get this working 2-way and seamlessly. Already love seeing emails i send from my phone magically appear in Zammad and get tracked. I think others will find this functionality invaluable as well e.g. as a mobile client.

@thorsteneckel could help here. :slight_smile:
I think writing to support[at]zammad.com will also help.

@dsukhin
ā€žā€¦and messages sent from IMAP (any email client) are appended to the relevant ticket in Zammadā€œ
Iā€˜m not shure if I understand what you are going to do, but as gar as I understand this wish, It is already possible.

ā€žIn the absence of a mobile version of Zammad, being able to reply from any client and having the reply appear and be properly tracked in Zammad would be awesome.ā€œ

If I write a eMail from my mobile phone or any other E-Mail client this mail will create a ticket. I get a reply from zammad in my E-Mail inbox that the ticket has been created.
If the agent replies to my ticket, I also get this reply on my mobile in my email inbox and if I reply to that email, this reply is added to the ticket in Zammad.
Iā€˜m already able to do the whole conversation by mail.

Probably Iā€˜m think wired, but I donā€˜t understand what you are trying to do and which usecase you are thinking of.

Hey @gwingend,

You are correct. From a userā€™s perspective (who wants support from the agents in Zammad) this is possible - they send an email to the support inbox and a ticket is made. What I am suggesting to to also make this simple from the company side such that the company can just hit ā€œcomposeā€ and send an email directly to a user and Zammad would read that message from the sent inbox in IMAP and create a ticket. And when on the go, being able to reply from my iPhone to an incoming email directly from the support inbox email, everything also gets tracked. This means I donā€™t have to be in front of Zammad to manage things on the go and I get to keep the ability to reply quickly while still making sure Zammad knows I replied.

This solution allows Zammad to have a view of the whole support inbox and manage tickets even if they arenā€™t created or replied through Zammad. In a small company, this means you can still use the shared inbox login method while on the go to provide speedy support and then use Zammad and itā€™s rules to track follow ups and ad tags. In a larger company, this allows one or two key people like the manager (who may not be in front of Zammad all day) to have direct access to the support email and send replies without having to get to a computer and do it via Zammad and still have everything be tracked and managed with the rest of Zammads powerful tools for the rest of the team.

Let me know if this makes more sense.
David

1 Like

Hey @dsukhin,

thanks for clearification.
Now I understand what you mean.
That makes sense.
But, if you are able to code, wonĀ“t it be better to invest the time in creating a mobil version?

Certainly. We will get there eventually but I think this two way sync is low hanging fruit which we could finish in a few weeks (itā€™s already halfway working in my version that I have added to). It will be able to give anyone the ability to respond on the go using any GUI (email client) they want. A mobile version is a much larger project but also certainly important in the future that will be worked on over a longer period of time.

HI @dsukhin - great to read your proposal. We will discuss this internally and I will come back to you.

I can read a great passion in your writing. Keep it up! :rocket:

1 Like

Hey @thorsteneckel. Thanks for your support and encouragement. Believe it or not, Iā€™m an almost done with with a pull request for this feature as well. The Zammad codebase and system design is organized very well and I am quite enamored by how succinct and powerful ruby can be (havenā€™t touched it in almost 8 years but it was so easy to pick up again and get things done quickly).

I am just finalizing some details for unit tests for my new work/features, making some final design choices (which I may share so we can talk about and decide together), and ensuring full backward compatability in all the options, functionality.

Iā€™ll submit a PR for your to check out soon.

David

How cool is that! Canā€™t wait to see your Pull Request.

Just submitted. Let me know your thoughts. I appreciate any comments. :slight_smile:

2 Likes

Hey. Checking in. I fixed all of the rubocop style warnings and I see a few final test cases misbehaving (sendmail tests). Would love any insights and help in making the final fixes and getting everything ready to merge including running my new tests which arenā€™t executed by Travis. What can I do to help make the final improvements? Any other thoughts/comments?

1 Like