Take the 2-minute tour ×

this.. nice.. exchange server converts my text/plain messages from text to html and messes them up, just because it detects html somewhere in the body.

how can i stop him from doing so?

edit: i am looking for a server side fix - this is affecting automatically generated emails from an application server. the messages are generated in java explicitly with

     message.setContent("This is a <span>Test</span>", "text/plain");

like mundeep points out.

i think it does not matter, but the messages are retrieved via outlook directly or via exchange web access. (without pop/imap)

share|improve this question
Are you looking for instructions on how to change this setting on the Exchange server, or are you after a client side fix? –  Kara Marfia May 20 '09 at 14:50
a server side fix - this is affecting automatically generated emails from an application server –  Andreas Petersson May 20 '09 at 19:22
Is it just any HTML, such as stray links, or is it full HTML inside [html] tags? I ask because I can't make my own Exchange 2007 do this. –  sysadmin1138 May 20 '09 at 19:49
the messages start with plain text and java stacktraces followed by comments wich contain some html tags as comments - so of a 140 kb text message there are 5 tags in the middle of the document. –  Andreas Petersson May 21 '09 at 13:04

4 Answers 4

You don't mention how the messages are being retrieved, but I have seen this before with Exchange 2007 and IMAP retrieval (though I believe it affects POP3 as well).

Have a look at this Technet document, specifically the ImapMessagesRetrievalMimeFormat switch. The documentation is exceedingly vague, but Exchange can force the format of the messages as they are retrieved from the server, either by user (as the link indicates) or on the service itself; in which case you would use the Set-ImapSettings command, and change the MessageRetrievalMimeFormat option.

The current setting for the service on your host can either be seen using PowerShell using the following and looking for 'MessageRetrievalMimeFormat':

Get-ImapSettings | fl

Alternatively you can use the GUI:

  1. Expand 'Server Configuration'
  2. Expand 'Client Access'
  3. Select the server that you want to manage, then the 'POP3 and IMAP' tab
  4. Get the properties of the appropriate connector and examine the 'Retrieval Settings' tab. The MIME format for the connector in question can be seen/changed in the 'Message MIME format' drop-down box at the top of this box.

A similar thing can be done for individual mailboxes by getting the properties of the mailbox and looking at the 'Mailbox Features' tab.

I can't tell you what setting is correct for your situation (as the documentation is so vague), but my Exchange 2007 installation has the setting left on 'Best Body Format'.

share|improve this answer
messages are retreived via outlook directly. –  Andreas Petersson May 21 '09 at 13:02
Thanks. Solved a problem where a custom POP3 text-only client of Exchange was not receiving any "text/plain" part. –  avenmore Feb 29 '12 at 18:58

Are you certain the MIME type is explicitly being set to "text/plain" when the message is sent?

For example in .NET you can set the message format to plain text or html explicitly eg:

msgMail.BodyFormat = MailFormat.Text;

In java you should be able to explicitly send a plain text message by setting the MIME type to "text/plain" eg:

  MimeMessage message = new MimeMessage(mailSession);
  message.setSubject("Testing javamail plain");
  message.setContent("This is a test", "text/plain");
share|improve this answer
yes, it is set exactly like message.setContent("This is a test", "text/plain"); in java. –  Andreas Petersson May 24 '09 at 8:27

I found a weak work-around in an August 10, 2007 thread of the newsgroup microsoft.public.exchange.applications, but did not test it yet. Mikhail Teterin discovered that one can send messages in two parts, a plain text and an HTML piece as "multipart/mixed", not as "multipart/alternative". The Exchange server will still convert the plain text part into HTML but due to the type of the aggregated message being "multipart/mixed", it will preserve the HTML part.


I saw another suggestion to "force Exchange to keep the message as the recieved 7bit MIME type" and references to Microsoft articles in the same thread from Oliver Moazzezi, but I could not find the exact implementation of his suggestion.

share|improve this answer

Ever find an answer? I've run into a similar issue and located this: http://support.microsoft.com/kb/946641

Apparently the default behavior changed when Exchange Server 2007 Service Pack 1 was released. I haven't had an opportunity to test it just yet, but hopefully it solves your issue.

share|improve this answer

Your Answer


