[Solved] c# how to get mail name (uid) after send [closed]


You can read all of the email file names in the C:\Temp directory like so: –

DirectoryInfo dirInfo = new DirectoryInfo(@"C:\Temp");
foreach (FileInfo fInfo in dirInfo.GetFiles("*.eml*"))
{
     Console.WriteLine(fInfo.Name);
}
Console.Read();

You could potentially get the the newest created file in that directory which would give you the last email sent, though I’m not exactly sure what it is you’re trying to achieve: –

var file = (from f in dirInfo.GetFiles("*.eml*")
             orderby f.LastWriteTime descending
             select f).First();

Which would return the newest email created (e.g. the one you just sent) in the C:\Temp dir.

solved c# how to get mail name (uid) after send [closed]