MailBee.NET Objects 4.0

MailMessage.SetUniqueMessageID Method 

Sets a new unique value of Message-ID header and returns it.

public string SetUniqueMessageID(
   string domain
);

Parameters

domain
The domain name to be put in the MessageID field. If a null reference or an empty string, the local computer name is used.

Return Value

A string containing the new unique value Message-ID value (without angle brackets).

Remarks

Message-ID value is composed of the current thread ID + "." + the random string + "@" + the domain name. This value is assigned to MessageID property. Also, MailBee encloses it with angle brackets (<>) and puts it into Message-ID header value.

You can set Message-ID value manually using MessageID property.

Note   MailBee automatically sets unique Message-ID value when the mail message is being sent (or submitted to the pickup folder) unless MailMessage.Builder.SetMessageIDOnSend property is set to false.

Example

This sample creates a new message and sets its Message-ID.

[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)
MailMessage msg = new MailMessage();
Console.WriteLine(msg.MessageID);
msg.SetUniqueMessageID("afterlogic.com");
Console.WriteLine(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)
Dim msg As New MailMessage
Console.WriteLine(msg.MessageID)
msg.SetUniqueMessageID("afterlogic.com")
Console.WriteLine(msg.MessageID)

See Also

MailMessage Class | MailBee.Mime Namespace