High priority emails

There are several different email headers that make email high priority.

Most correct is Priority header, but also Importance is used.
Outlook uses X-Priority header.

Mail.dll email library offers simple solution of this problem: PriorityHigh() method.

The following code sends high priority email, that has all mentioned above headers set accordingly:

// C# version:

using Fluent = Limilabs.Mail.Fluent;

Fluent.Mail.Html("<html>....</html>")
    .Subject("This is important")
    .To("to@example.com")
    .From("from@example.com")
    .PriorityHigh()
    .UsingNewSmtp()
    .Server("smtp.example.com")
    .WithCredentials("user", "password")
    .WithSSL()
    .Send();

and as usual VB.NET code:

' VB.NET version:

Imports Fluent = Limilabs.Mail.Fluent;

Fluent.Mail.Html("<html>....</html>") _
    .Subject("This is important") _
    .To("to@example.com") _
    .From("from@example.com") _
    .PriorityHigh() _
    .UsingNewSmtp() _
    .Server("smtp.example.com") _
    .WithCredentials("user", "password") _
    .WithSSL() _
    .Send()

PriorityLow() method is also available.

It’s also really easy to check the email’s priority with GetGenericPriority.
GetGenericPriority checks Priority, Importance and X-Priority headers.

// C# version:

IMail email = new MailBuilder()
    .CreateFromEml(imap.GetMessageByUID(uid))
GenericPriority priority = email.GetGenericPriority());

' VB.NET version:

Dim email As IMail = New MailBuilder() _
    .CreateFromEml(imap.GetMessageByUID(uid))
Dim priority As GenericPriority = email.GetGenericPriority()

Tags: , , ,

Questions?

Consider using our Q&A forum for asking any questions.