Mime MessagePriority Property
Get or set the value of the Priority header.
Definition
Namespace: MimeKit
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
The priority.
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public MessagePriority Priority { get; set; }Property Value
MessagePriorityThe priority.
Implements
IMimeMessagePriorityRemarks
Gets or sets the value of the Priority header.
Example
C#
public static MimeMessage CreateMessage ()
{
var message = new MimeMessage ();
// Add the sender and the recipients. Each of these properties is an InternetAddressList,
// so any number of addresses may be added.
message.From.Add (new MailboxAddress ("Joey Tribbiani", "joey@friends.com"));
message.To.Add (new MailboxAddress ("Chandler Bing", "chandler@friends.com"));
message.Cc.Add (new MailboxAddress ("Monica Geller", "monica@friends.com"));
message.Subject = "How you doin'?";
// Optional: MimeMessage generates a Message-Id and Date automatically, but they may
// be set explicitly if needed.
message.MessageId = MimeUtils.GenerateMessageId ("friends.com");
message.Date = DateTimeOffset.Now;
// Optional: flag the message as important.
message.Importance = MessageImportance.High;
message.Priority = MessagePriority.Urgent;
// Set the body of the message. For anything more complicated than a single text
// part, consider using the BodyBuilder class.
message.Body = new TextPart (TextFormat.Plain) {
Text = @"Hey Chandler,
I just wanted to let you know that Monica and I were going to go play some paintball, you in?
-- Joey"
};
return message;
}
Exceptions
| ArgumentOutOfRangeException | value is not a valid MessagePriority. |