bobble14988
bobble14988

Reputation: 1756

Change colour of emails being sent

In Outlook if you go to...

Tools > Organise > Using 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:

I know you can use MailPriority.High too but this isn't good enough.

Upvotes: 0

Views: 1784

Answers (2)

Christophe Geers
Christophe Geers

Reputation: 8962

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.

Upvotes: 2

CodeCaster
CodeCaster

Reputation: 151664

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.

Upvotes: 4

Related Questions