When you create an email without message ID, the
MailMessage object will generate a message ID for you.
However, I was unable to reproduce the issue you describe. I tried it with Gmail and Microsoft Exchange, and with both of these servers, the message ID of the received message corresponds to the ID of the locally sent message.
This is the code I used:
// create a mail message
var mail = new MailMessage();
mail.From = "firstname.lastname@example.org";
mail.To = "email@example.com";
mail.Subject = "Sample subject";
mail.BodyText = "Sample text.";
// send the mail message
var client = new Smtp();
client.LogWriter = new ConsoleLogWriter(LogLevel.Debug);
// save the mail message
In my tests, the
Message-ID header in the
sample.eml file was the same as
Message-ID of the message in recipient's mailbox.
If you get different results, please let us know what you are doing differently.