Xylos brands

Having fun with Mime types in Exchange 2010

When you migrate from Exchange 2003 to Exchange 2010 you may have some problems with xml attachments. Al of a sudden xml attachments are sent as application/xml mime type instead of text/xml. In our case the application was specifically looking for text/xml, and thus wouldn't detect the attachment.

You could solve this problem by creating a transport rule as you can see below.

  1. Select the conditions "from users that are inside or outside the organization" and 'when the message header contains specific words"".
  2. Select the action '""set header with value"".
  3. Create the new transport rule.

To verify if the transport rule is working, you have to enable pipeline tracking on the HUB transport server. Now you can send a new message with a xml attachment to see if the transport rule changes the Content-Type.

In Exchange 2003 there was interface for editing and sorting these associations:

If you want to view the file type associations in Exchange 2010, you can do this with Exchange PowerShell by the following command:

""Get-OrganizationConfig |fl MimeTypes""

Changing the MimeTypes with EMS\EMC is not possible however. You have to do this with ADSI edit but the attribute is decoded.

You can decode it with the following PowerShell script:

 

 clear
             $file = "C:\local\export.txt"
             $num1 = "74 65 78 74 2F 68 74 6D 6C 3B 68…"
             $array += $num1.Split() | ForEach{[Convert]::ToInt32($_,16)} | ForEach{[Convert]::ToChar($_)}
             foreach ($char in $array)
             {
             if ($char -eq ';')
             {
             $out+="`r`n"
             }
             else
             {
             $out+=$char
             }
             }
             $out
             Add-Content $file $out

Or buy the developer a beer and ask him to change his code, what is what we did in the end.

Note 1: post co-authored by Frederiek Goemaere and Koen Vermoesen, with input from Danny De Haan and Emmanuel Cambier
Note 2: cross-posted on both Pro-exchange and Xylos blogs.

Share this blogpost

Also interesting for you

Leave a reply

Your email address will not be published. Required fields are marked.