How to identify a mail chain in logic app ?

Tushar Lakhotia 0 Reputation points
2025-01-11T13:38:08.8133333+00:00

Hello Team,

I am using Logic apps for one of my client in which we forward the email using logic apps to thier respective department based onto the body of the mail and I also need to store the emails into a database.

I am able to do the above things easily . But Now when someone reply to those mails , its becomes a chain of mail . Now In the storeage field instead of storing the mail as new mail. I need to update the previously stored mail with the new body or have a coomnon key atleast, so that I can maintain the chain in the database.

But In the logic app , I am not able to identify is this a new mail or a reply to one of the previous mail.

I am also not able to find any such common field with the parent mail and the reply mails. The CONVERSTION_ID and MESSAGE_ID field are also different for the parent and reply mail respectively.

Thanks in Advance !

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,304 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Nitish Sharma 436 Reputation points
    2025-01-11T21:18:43.8633333+00:00

    Hi @Tushar Lakhotia ,

    I can think of 2 ways of doing this:

    I hope the mail subject lines remain common in replies and no one is updating the subject of mail while replying to it. You can use subject of mail as a key to group emails in the database. Strip prefixes like RE or FW to normalize the subject for matching and updating the body of mail.

    If subject is not the only thing that can be used to link, then it will be good to combine multiple fields like sender mail address, recipient mail address, and subject.

    You can try the above 2 options to link and save your mail in the database.


  2. Nitish Sharma 436 Reputation points
    2025-01-12T19:59:36.4133333+00:00

    @Tushar Lakhotia I have tested the approach, and you should use Conversation Id as it remains the same whenever anyone replies or forwards the same mail.

    So you can use that to link the mail chain and overwrite the mail in your database.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.