2

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)

Andreas Petersson
  • 121
  • 1
  • 3
  • 5
  • 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 Answers4

3

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'.

Gavin McTaggart
  • 1,826
  • 16
  • 14
1

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");
mundeep
  • 916
  • 8
  • 10
1

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.

http://groups.google.com/group/microsoft.public.exchange.applications/browse_thread/thread/d87170330acbee62/

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.

eel ghEEz
  • 113
  • 4
1

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.

Blackstone
  • 11
  • 1