Answer the question
In order to leave comments, you need to log in
How to use PHP to organize the exchange of letters in such a way as to highlight the correspondence within a single call?
There is a portal, on the portal there is a section for receiving and processing requests that come by mail to a specific mailbox.
We divide all letters into two types: NEW and RESPONSE.
RESPONSE - those who came IN ANSWER to our letter (or our answer to their previous letter).
NEW is, accordingly, just a new letter.
It is necessary to organize communication with each addressee in such a way that the NEW letter from him is processed as a new task (request, call it whatever you like), and the REPLY letter becomes, as it were, a comment IN THE CORRESPONDENCE TREE WITHIN THE FRAMEWORK OF THE ORIGINAL NEW SPECIFIC LETTER.
I think it’s clear about the new, but I’ll explain the second part with an example:
1. The addressee sent a request by mail. The server processed the mailbox through imap_open, found new letters there and wrote it to the database, after which this appeal appeared on the frontend in the required table.
2. Manager, clicks on this appeal, reads the description (the description is the text of the letter) and he has questions or a ready answer. He presses the answer button, writes the text, presses "Send". The letter leaves, and its text with a subject (or without) is stored in the database and displayed as part of the request (point 1) upon opening this request.
3. The addressee receives a response from the manager to his mail and writes his answer. Sends.
4. The server through php imap_open sees the letter and here is the question - "How to understand if this is a new letter or is it a response to the one sent by us?"
The only thing I came up with is to generate an ID-shnik when receiving a new letter and add it to the subject of the appeal, saving it when answering and checking when receiving the presence of this ID in the subject of the letter. Everything is fine, but there is one thing - "And if the addressee, for some reason, erases the subject of the response letter and writes another one? Well, you never know ..." In this case, our system will think that this is a new appeal, not an answer.
Here I start to think, maybe there is some way to track emails by email headers?
Answer the question
In order to leave comments, you need to log in
Here I start to think, maybe there is some way to track emails by email headers
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question