Sendgrid-csharp: How do you set email priority?

Created on 23 Jun 2016  路  3Comments  路  Source: sendgrid/sendgrid-csharp

How do I set the message priority (i.e. make it marked urgent / high priority in Outlook, etc.)?

I tried (where "mailMessage" is SendGrid.Helpers.Mail.Mail object):

mailMessage.Headers.Add("Priority", "Urgent");
mailMessage.Headers.Add("Importance", "high");

It throws an Object reference not set to instance of an object error.

If I remove these two lines of code, the implementation works fine (albeit, now just a normal priority message) and the message is sent and received.

I am using the version currently deployed through Nuget (7.0.2.0 / 2.0.4.0 / 1.3.1.0).

help wanted question

Most helpful comment

Thanks @eat-sleep-code . Had the same issue.

All 3 comments

Figured it out, the following works...

mailMessage.AddHeader("Priority", "Urgent");
mailMessage.AddHeader("Importance", "high");

Thanks for sharing your solution @eat-sleep-code!

Thanks @eat-sleep-code . Had the same issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

clairernovotny picture clairernovotny  路  4Comments

LorenDorez picture LorenDorez  路  4Comments

lijaso picture lijaso  路  3Comments

shiglet picture shiglet  路  3Comments

CalvinFengDatacom picture CalvinFengDatacom  路  4Comments