We recently ran into an issue where subjects from external sources might appear to be garbled when using Exchange Server 2007 and the solution we found required a bit of digging.
Per RFC 2047, encoded words can be used within the subject headers of a message and indeed Exchange Server 2007 is no exception and does support this. In a MIME message an encoded subject may look something like this:
The first part, ISO-8859-1, indicates the charset the subject is using, the B indicates that the remaining data is Base64 encoded and everything between the subsequent ? and ?= is the Base64 encoded subject. Quoted Printable is also supported and the same subject in quoted printable would appear as such:
What we ran into is that particularly long subjects were not being unencoded. As the message went through conversion we would truncate the subject to a maximum of 255 characters (while also appending "..."). What resulted was a rather unreadable subject in any client, whether it be Outlook, OWA, or your favorite POP/IMAP based reader. What we found is that, by default, Exchange Server 2007 will not attempt to decode any subject header that exceeds a total encoded length greater than 255 characters.
To resolve this you have to make the following changes on your Hub Servers (this has no affect on Edge):
- In the \Exchange Server\Bin directory, open the EdgeTransport.Exe.Config file.
- It should start with something that looks similar to:
<gcServer enabled="false" />
...and so on.
- Add the following lines between the <configuration> and <runtime> elements:
type="Microsoft.Exchange.Data.Internal.CtsConfigurationSection, Microsoft.Exchange.Data.Common, PublicKeyToken=31bf3856ad364e35, version=8.0.681.0,
- Save and exit the .config file.
- Restart the MSExchangeTransport service.
- Resubmit your message and confirm the fix is working
Note: Step 3. The version does not need to be change based on the version of Exchange (E2K7 SP1, SP1 RU7, etc,.) that you have installed.
Base64 and Quoted-Printable encoding is going to introduce some additional bloat to the subject length so whatever value you set in the MaximumEncodedWordLength will need to support your maximum encoded values.
Please note: No matter how long of a subject you submit, Exchange will ultimately truncate the unencoded version of that subject down to 255 characters and append "...".