1

i am developing an application which reads .eml files and extract their data and does some processes with these data with c#
i am using MimeKit package. how can I differentiate between sent or received email?

here is part of my code:

private static List<List<string>> GetNextMail(string emlFile, int mailNumber)
{
    try
    {
        // eml file is the path of eml
        var mimeMessage = MimeMessage.Load(emlFile);
        return GetNextMail(mimeMessage,mailNumber);
    }
    catch (Exception ex)
    {
        return null;
    }
}

how can I use mimeMessage object for differentiating between sent or receive emails?

ThomasArdal
  • 4,999
  • 4
  • 33
  • 73
AlirezaEiji
  • 29
  • 1
  • 5
  • In which context does the application run? If it runs for a user/organisation you could analyze the from-address and either compare it to the user's mail address or against the domain of the company (in the simplest case like: ends with "@myorganisiation.com" or with a regex for more complex cases). – Markus Jul 12 '22 at 13:11
  • 1
    The `.eml` format does not contain this information. That having been said, *received* mail will usually contain `Received: ...` headers and *sent* mail won't, so you might use that as a workaround. – Heinzi Jul 12 '22 at 13:20

1 Answers1

0

Inbox folder will contain receiving mail.