In Outlook if you go to...
Tools > Organise > Using开发者_C百科 Colors (Tab)
...you can change the colour in your inbox of emails that meet conditions (sent from, sent to etc).
Is there a way to do this programatically with C#?
At the moment I have a simple MailMessage object used similar to this example.
My requirement is this:
- Change the colour of the email being received by a person so that it can be seen as more urgent
I know you can use MailPriority.High too but this isn't good enough.
The colors are assigned by Outlook, based on the criteria the Outlook user has supplied.
You cannot influence this from the sender's perspective, other than trying to meet the criteria if those are known to you (sent from, sent to, subject containing specific words, body containing specific words, and so on), since 'color' isn't an email property.
To elaborate on CodeCaster's answer.
It is indeed up to the receiver to configure his e-mail client as he desires. You can't impose those rules in your e-mail so that they will draw attention once they arrive in the recipient's e-mail inbox. If that were allowed ... just imagine the layout of your inbox.
You can however style the contents of your e-mail quite easily if you use a HTML-formatted e-mail.
For example:
var message = new MailMessage(fromEmailAddress, toEmailAddress);
message.Subject = "This is a test";
message.Body = "<h2>This is an HTML-formatted e-mail.</h2>";
message.IsBodyHtml = true;
var smtp = new SmtpClient();
smtp.Send(message);
You can find more information here:
https://web.archive.org/web/20211020150716/https://www.4guysfromrolla.com/articles/080206-1.aspx
However this approach won't colorize the items in the recipients inbox. It will only show up when he reads the e-mails. And then he can still disable HTML-formatted e-mails in his client.
Maybe you want to enforce such a rule for your company's email? If you are using an Exchange Server then this might be possible:
https://serverfault.com/questions/20950/distributing-rules-to-outlook-2003-and-2007-clients
But you are better off asking this on ServerFault.com if that's the case.
精彩评论