Giter Club home page Giter Club logo

Comments (5)

tomolimo avatar tomolimo commented on June 29, 2024

Hello @andrepetinga

To understand the behavior of the mailanalyzer plugin, you first have to know that email clients and email servers are not behaving the same way. One client may behave one way, and another client may behave another way.

Then, to explain how is behaving mailanalyzer:

  1. It's getting some information from the email headers, information that may come from email clients or email servers: the so called "Thread-Index" and the "Message-ID". If you send an email to GLPI, you'll see these two info in the DB:
    image
    For example, on this screencopy, you may see on the rows with id 5 and 1 are from a Thread-Index header param, and the values with the < and > are from a Message-Id header param. You may find both in emails, you may find only the Message-Id (one more time, it depends on the clients and servers). In this example, there were both info for ticket 368042.
  2. For the replies or the forward, how are they detected? Usually, the email clients will add the original email identifier in the header of the reply, and in the header of the forward. They are adding the original Thread-Index or/and the original Message-Id in the header of the new email. Then when MailAnalyzer plugin will receive one of these emails, it will check if the Thread-Index or the Message-Id are already existing in the DB, and if yes it will add the emails as followups into the existing ticket.
  3. But sometimes the email clients will not send back the references (in case of replies) or they will create new references
  4. And the Thread-Index will be re-computed at any time by the email clients if the original subject is changed! Not recomputed by the Re: (or Fwd:), but recomputed if the user added a char to the end of the subject (for example), and then when the MailAnalyzer will receive this email it will not be able to add it to an existing ticket, as the references are not matching an existing ticket.
  5. Usually, when you forward an email, the references to the original email are lost. But we may imagine that some email clients are keeping them in the forwarded emails. If they are kept, then MailAnalyzer will match the emails to an existing ticket. If not, then it will allow te creation of a new ticket.
  6. MailAnalyzer is NOT using the subject of the emails in order to match them to existing tickets. It is ONLY using the internal Thread-Index and/or Message-Id.
  7. You may check the headers of the received emails to see if the the Thread-Index is present or not (and if this Thread-Index is the same than the original) from the replies of the forwarded emails.

I hope this clarify the MailAnalyzer behavior, if not don't hesitate to ask me.

Thank you,
Regards
Tomolimo

from mailanalyzer.

andrepetinga avatar andrepetinga commented on June 29, 2024

If I understood you correctly, then looking at this:
image

We can see a ticket with 1 "Thread-Index" (line) 1 and 3 "Message-ID" (lines 2, 3 and 4).

This is the message I've sent:

image

And this is my coworker message:

image

So you are saving the Message-ID from each message and, in adition, the "In-Reply-To" reference. That is why we have only 2 emails sent, but 3 lines inserted. Correct?

But looking at this messages, the "Thread-Index" is different! So, how are they getting stuck on the same ticket?

Other thing, the "Thread-Index" in the Database is "a13fa0b95325ce4cbbb86ccc45f2613f" which is not matching with anyone of the id's from the email header.

In the email I received (sent from Gmail to our corporate email), I found the "Message-ID" which is the same as the "In-Reply-To" found on the 2 emails sent to GLPI. But I cannot find "Thread-Index" on this message.
Also opening the sent email in Gmail, I can only find the "Message-ID", not the "Thread-Index".

from mailanalyzer.

tomolimo avatar tomolimo commented on June 29, 2024

Hello @andrepetinga

So you are saving the Message-ID from each message and, in adition, the "In-Reply-To" reference. That is why we have only 2 emails sent, but 3 lines inserted. Correct?

Yes

But looking at this messages, the "Thread-Index" is different! So, how are they getting stuck on the same ticket?

Other thing, the "Thread-Index" in the Database is "a13fa0b95325ce4cbbb86ccc45f2613f" which is not matching with anyone of the id's from the email header.

Here is the explanation: the Thread-Index is a complex computation (you may check here the complete decoding of the Thread-Index: http://msdn.microsoft.com/en-us/library/ee202481%28v=exchg.80%29.aspx), and we store in the DB not really the Thread-Index, but a part of it named PtypGuid (GUID (16 bytes): A PtypGuid type ([MS-OXCDATA] section 2.11.1) that is generated for each new conversation thread), and this GUID is computed with this formula: $messages_id[] = bin2hex(substr(base64_decode($message->threadindex), 6, 16 )); in the Thread-Index you not only the thread index of the original message, but also an index of the current message and some other info.

Try this PHP code:

$thread_index = "AQHW6NdDoT+guVMlzky7uGzMRfJhP6oj3OEQ";
echo bin2hex(substr(base64_decode($thread_index), 6, 16 ));

echo "\r\n";

$thread_index = "AQHW6NdD1jfUP1rHmEC/CFoLI/Wd7aoj3OAw";
echo bin2hex(substr(base64_decode($thread_index), 6, 16 ));

Here are the results:

a13fa0b95325ce4cbbb86ccc45f2613f 
d637d43f5ac79840bf085a0b23f59ded

a13fa0b95325ce4cbbb86ccc45f2613f -> same GUID than in DB
d637d43f5ac79840bf085a0b23f59ded -> GUIDs are differents, but in the email you can find the same Message-Id in the "References" field than the first email. so it means that these emails are matching the same tickets.

In the email I received (sent from Gmail to our corporate email), I found the "Message-ID" which is the same as the "In-Reply-To" found on the 2 emails sent to GLPI. But I cannot find "Thread-Index" on this message.

As explained, email clients are managing these indexes like they want...

Thank you,
Regards,
Tomolimo

from mailanalyzer.

andrepetinga avatar andrepetinga commented on June 29, 2024

Ok, thanks for the answers.

from mailanalyzer.

tomolimo avatar tomolimo commented on June 29, 2024

you're welcome 😃

from mailanalyzer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.