Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I want to set the mail priority using SPUtility.SendMail()

I know I can do it with

MailMessage myMail = new MailMessage();
myMail.From = "from@microsoft.com";
myMail.To = "to@microsoft.com";
myMail.Subject = "UtilMailMessage001";
myMail.Priority = MailPriority.Low;

But my data center folks want me to use SPUtility.SendMail(). Is it possbile to set the priority with SPUtility.SendMail()?

Thanks,

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

I have not had an opportunity to try this, but there is a constructor of SPUtility.SendEmail which accepts a StringDictionary of MessageHeaders.

According to this link, these are the 3 headers Microsoft uses to create a high priority email.

X-Priority: 1 (Highest)
X-MSMail-Priority: High
Importance: High

So to use it with SPUtility.SendEmail, use this code to create the headers.

StringDictionary messageHeaders = new StringDictionary();
messageHeaders.Add("X-Priority", "1 (Highest)");
messageHeaders.Add("X-MSMail-Priority", "High");
messageHeaders.Add("Importance", "High");
share|improve this answer
    
for completness. I also added the folowing headers since they were no longer parameters messageHeader.Add("to", MySettings.Instance.ToAddress); messageHeader.Add("from", "sharepoint@test.com"); messageHeader.Add("subject", "subject"); messageHeader.Add("content-type", "text/html"); –  mikemurf22 Sep 12 '11 at 21:02
add comment

No, there is nothing in the function to specify email priority. You would need to use the .NET mail functions that you mentioned in your post. See http://msdn.microsoft.com/en-us/library/ms463202.aspx for all the available options on that function.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.