Gets or sets the Message-ID header of the message.
A string containing the Message-ID. For newly created messages, it's an empty string; for existing messages (received from mail servers, loaded from disk, etc), it's set from the Message-ID header value during parsing the message.
During sending the message or submitting it to the pickup folder, this property is set to a new unique value (unless MailMessage.Builder.SetMessageIDOnSend is false).
You can also set Message-ID manually using SetUniqueMessageID method.
In MIME, Message-ID value is enclosed in angle brackets (<>). This property returns Message-ID value with angle brackets. Also, if you assign a new value without trailing angle brackets, they will be added to MessageID value automatically.
Note Message-ID (MID) is NOT the same as Unique-ID (UID) which is assigned to each message in the mailbox by the POP3 or IMAP4 server.
This sample loads the message from .EML file and displays the Message-ID of this message.
[C#] // To use the code below, import MailBee namespaces at the top of your code. using MailBee; using MailBee.Mime; // The actual code (put it into a method of your class) // Load the message from file. MailMessage msg = new MailMessage(); msg.LoadMessage(@"C:\Docs\TestMail.eml"); // Show the Message-ID. Console.WriteLine("The message ID is " + msg.MessageID);
[Visual Basic] ' To use the code below, import MailBee namespaces at the top of your code. Imports MailBee Imports MailBee.Mime ' The actual code (put it into a method of your class) ' Load the message from file. Dim msg As New MailMessage msg.LoadMessage("C:\Docs\TestMail.eml") ' Show the Message-ID. Console.WriteLine("The message ID is " & msg.MessageID)
MailMessage Class | MailBee.Mime Namespace | SetMessageIDOnSend