Base64 Decoding problem
this is actually a continuation from http://social.technet.microsoft.com/Forums/en-US/exchangesvrgeneral/thread/71ad755e-10c8-4586-9b17-6e020785c2c9 I have managed to enable pipeline tracing and captured the incoming mail and conpared to the received mail. This is the original.eml ========== X-CreatedBy: MessageSnapshot-Begin injected headers X-MessageSnapshot-UTC-Time: 2011-07-08T05:14:22.618Z X-MessageSnapshot-Protocol-Id: 08CE0ADDBDB6FC41;2011-07-08T05:14:22.602Z;1 X-MessageSnapshot-Source: Original X-Sender: sender@senderdomain.com X-Receiver: recipient@recipientdomain.com X-EndOfInjectedXHeaders: MessageSnapshot-End injected headers Received: from server1.recipientdomain.local (192.168.159.10) by server2.recipientdomain.local (192.168.159.68) with Microsoft SMTP Server id 7.8.9.0; Fri, 8 Jul 2011 13:14:22 +0800 Message-ID: <15650f3200000df3@recipientdomain.local> X-TM-IMSS-Message-ID: <15650f3200000df3@recipientdomain.local> Received: from svr1.senderdomain.com ([1.2.3.4]) by recipientdomain.local ([192.168.159.10]) with ESMTP (TREND IMSS SMTP Service 7.1) id 15650f3200000df3 ; Fri, 8 Jul 2011 13:15:03 +0800 Received: by svr1.senderdomain.com (Postfix, from userid 502) id 6AC5913881DF; Fri, 8 Jul 2011 13:15:02 +0800 (SGT) To: "'recipient name'" <recipient@recipientdomain.com> Subject: Re: [#1053292] Subject Header MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: base64 X-TM-AS-Product-Ver: IMSS-7.1.0.1394-6.8.0.1017-18246.004 X-TM-AS-Result: No--13.750-5.0-31-1 X-imss-scan-details: No--13.750-5.0-31-1 Content-Type: text/plain From: <sender@senderdomain.com> Return-Path: sender@senderdomain.com Date: Fri, 8 Jul 2011 13:14:22 +0800 X-MS-Exchange-Organization-OriginalArrivalTime: 08 Jul 2011 05:14:22.6338 (UTC) X-MS-Exchange-Forest-ArrivalHubServer: server2.recipientdomain.local X-MS-Exchange-Organization-OriginalClientIPAddress: 192.168.159.10 X-MS-Exchange-Organization-OriginalServerIPAddress: 192.168.159.68 X-MS-Exchange-Organization-AuthSource: server2.recipientdomain.local X-MS-Exchange-Organization-AuthAs: Anonymous X-MS-Exchange-Organization-MessageDirectionality: Incoming b3JpZ2luYWwgY29udGVudCBoYXMgYmVlbiByZW1vdmVkIGFuZCBpbnNlcnRlZCB3aXRoIHJhbmRvbSBzdHVmZg== ========== and this is the email received by the user ========== Received: from server1.recipientdomain.local (192.168.159.10) by server2.recipientdomain.local (192.168.150.68) with Microsoft SMTP Server id 7.8.9.0; Fri, 8 Jul 2011 13:14:22 +0800 Received: from svr1.senderdomain.com ([1.2.3.4]) by recipientdomain.local ([192.168.150.10]) with ESMTP (TREND IMSS SMTP Service 7.1) id 15650f3200000df3 ; Fri, 8 Jul 2011 13:15:03 +0800 Received: by svr1.senderdomain.com (Postfix, from userid 502) id 6AC5913881DF; Fri, 8 Jul 2011 13:15:02 +0800 (SGT) From: "sender@senderdomain.com" <sender@senderdomain.com> To: recipient name <recipient@recipientdomain.com> Subject: Re: [#1053292] Subject Header Thread-Topic: [#1053292] Subject Header Thread-Index: AQHMPS3lgzbj0eGK6karAQxIJNlMzg== Date: Fri, 8 Jul 2011 05:14:22 +0000 Message-ID: <15650f3200000df3@recipientdomain.local> Content-Language: en-SG X-MS-Has-Attach: X-MS-Exchange-Organization-SCL: 0 X-MS-TNEF-Correlator: x-tm-as-result: No--28.649600-8.000000-31 x-tm-as-product-ver: SMEX-10.0.0.4211-6.800.1017-18246.003 x-tm-as-user-blocked-sender: No x-tm-as-user-approved-sender: No x-imss-scan-details: No--13.750-5.0-31-1 x-tm-imss-message-id: <15650f3200000df3@recipientdomain.local> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 b3JpZ2luYWwgY29udGVudCBoYXMgYmVlbiByZW1vdmVkIGFuZCBpbnNlcnRlZCB3aXRoIHJhbmRvbSBzdHVmZg== ========== It is noted that the Content-Transfer-Encoding had been changed from Base64 to quoted-printable but the content was not decoded and encoded to quoted-printable. The following is also observed Issue only occurs to Ex 2010 mailbox but not Ex 2003 mailbox Issue only occurs when receiving from sender@senderdomain.com but not other senders from senderdomain.com I am running out of idea and appreciate if someone can provide furthur troubleshooting steps. Thanks! *update1: changed the base64 codes to 76 char per line. my bad, the content had been modified but i had copied the base64 codes directly from the encoder without linebreaking them.
July 11th, 2011 8:56am

On Mon, 11 Jul 2011 05:56:46 +0000, hayami.wai wrote: > > >this is actually a continuation from http://social.technet.microsoft.com/Forums/en-US/exchangesvrgeneral/thread/71ad755e-10c8-4586-9b17-6e020785c2c9 > >I have managed to enable pipeline tracing and captured the incoming mail and conpared to the received mail. > >This is the original.eml > >========== X-CreatedBy: MessageSnapshot-Begin injected headers >X-MessageSnapshot-UTC-Time: 2011-07-08T05:14:22.618Z >X-MessageSnapshot-Protocol-Id: 08CE0ADDBDB6FC41;2011-07-08T05:14:22.602Z;1 >X-MessageSnapshot-Source: Original >X-Sender: sender@senderdomain.com >X-Receiver: recipient@recipientdomain.com >X-EndOfInjectedXHeaders: MessageSnapshot-End injected headers >Received: from server1.recipientdomain.local (192.168.159.10) by server2.recipientdomain.local > (192.168.159.68) with Microsoft SMTP Server id 7.8.9.0; Fri, 8 Jul 2011 > 13:14:22 +0800 >Message-ID: <15650f3200000df3@recipientdomain.local> >X-TM-IMSS-Message-ID: <15650f3200000df3@recipientdomain.local> >Received: from svr1.senderdomain.com ([1.2.3.4]) by recipientdomain.local > ([192.168.159.10]) with ESMTP (TREND IMSS SMTP Service 7.1) id > 15650f3200000df3 ; Fri, 8 Jul 2011 13:15:03 +0800 >Received: by svr1.senderdomain.com (Postfix, from userid 502) id 6AC5913881DF; > Fri, 8 Jul 2011 13:15:02 +0800 (SGT) >To: "'recipient name'" <recipient@recipientdomain.com> >Subject: Re: [#1053292] Subject Header >MIME-Version: 1.0 >Content-Type: text/plain; > charset="iso-8859-2" >Content-Transfer-Encoding: base64 >X-TM-AS-Product-Ver: IMSS-7.1.0.1394-6.8.0.1017-18246.004 >X-TM-AS-Result: No--13.750-5.0-31-1 >X-imss-scan-details: No--13.750-5.0-31-1 >Content-Type: text/plain >From: <sender@senderdomain.com> >Return-Path: sender@senderdomain.com >Date: Fri, 8 Jul 2011 13:14:22 +0800 >X-MS-Exchange-Organization-OriginalArrivalTime: 08 Jul 2011 05:14:22.6338 > (UTC) >X-MS-Exchange-Forest-ArrivalHubServer: server2.recipientdomain.local >X-MS-Exchange-Organization-OriginalClientIPAddress: 192.168.159.10 >X-MS-Exchange-Organization-OriginalServerIPAddress: 192.168.159.68 >X-MS-Exchange-Organization-AuthSource: server2.recipientdomain.local >X-MS-Exchange-Organization-AuthAs: Anonymous >X-MS-Exchange-Organization-MessageDirectionality: Incoming > >b3JpZ2luYWwgY29udGVudCBoYXMgYmVlbiByZW1vdmVkIGFuZCBpbnNlcnRlZCB3aXRoIHJhbmRvbSBzdHVmZg== > > >========== > >and this is the email received by the user > >========== Received: from server1.recipientdomain.local (192.168.159.10) by server2.recipientdomain.local > (192.168.150.68) with Microsoft SMTP Server id 7.8.9.0; Fri, 8 Jul 2011 > 13:14:22 +0800 >Received: from svr1.senderdomain.com ([1.2.3.4]) by recipientdomain.local > ([192.168.150.10]) with ESMTP (TREND IMSS SMTP Service 7.1) id > 15650f3200000df3 ; Fri, 8 Jul 2011 13:15:03 +0800 >Received: by svr1.senderdomain.com (Postfix, from userid 502) id 6AC5913881DF; > Fri, 8 Jul 2011 13:15:02 +0800 (SGT) >From: "sender@senderdomain.com" <sender@senderdomain.com> >To: recipient name <recipient@recipientdomain.com> >Subject: Re: [#1053292] Subject Header >Thread-Topic: [#1053292] Subject Header >Thread-Index: AQHMPS3lgzbj0eGK6karAQxIJNlMzg== >Date: Fri, 8 Jul 2011 05:14:22 +0000 >Message-ID: <15650f3200000df3@recipientdomain.local> >Content-Language: en-SG >X-MS-Has-Attach: >X-MS-Exchange-Organization-SCL: 0 >X-MS-TNEF-Correlator: >x-tm-as-result: No--28.649600-8.000000-31 >x-tm-as-product-ver: SMEX-10.0.0.4211-6.800.1017-18246.003 >x-tm-as-user-blocked-sender: No >x-tm-as-user-approved-sender: No >x-imss-scan-details: No--13.750-5.0-31-1 >x-tm-imss-message-id: <15650f3200000df3@recipientdomain.local> >Content-Type: text/plain; charset="iso-8859-1" >Content-Transfer-Encoding: quoted-printable >MIME-Version: 1.0 > >b3JpZ2luYWwgY29udGVudCBoYXMgYmVlbiByZW1vdmVkIGFuZCBpbnNlcnRlZCB3aXRoIHJhbmRvbSBzdHVmZg== > >========== > >It is noted that the Content-Transfer-Encoding had been changed from Base64 to quoted-printable but the content was not decoded and encoded to quoted-printable. > >The following is also observed 1. Issue only occurs to Ex 2010 mailbox but not Ex 2003 mailbox 2. Issue only occurs when receiving from sender@senderdomain.com but not other senders from senderdomain.com > >I am running out of idea and appreciate if someone can provide furthur troubleshooting steps. Thanks! I think the problem here is that there are no MIME body parts! All you have is a message body with a MIME preamble section that's supposed to be readable in plain text by e-mail clients that don't understand MIME. Note the lack of any MIME delimiters in the message. RFC2046, Section 5.1.1. Common Syntax "There appears to be room for additional information prior to the first boundary delimiter line and following the final boundary delimiter line. These areas should generally be left blank, and implementations must ignore anything that appears before the first boundary delimiter line or after the last one. NOTE: These "preamble" and "epilogue" areas are generally not used because of the lack of proper typing of these parts and the lack of clear semantics for handling these areas at gateways, particularly X.400 gateways. However, rather than leaving the preamble area blank, many MIME implementations have found this to be a convenient place to insert an explanatory note for recipients who read the message with pre-MIME software, since such notes will be ignored by MIME-compliant software." The message header also has TWO "Content-Type" MIME headers! .. Content-Type: text/plain; .. charset="iso-8859-2" and .. Content-Type: text/plain The base64-encoded line is too long, too. See RFC2045 section 6.8 "The encoded output stream must be represented in lines of no more than 76 characters each." The easiest fix to this it to have the sender stop pretending that the messages are MIME and just remove all the MIME stuff. The alternative is to add the correct MIME headers to the message. --- Rich Matheisen MCSE+I, Exchange MVP --- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
July 11th, 2011 5:37pm

Hi Rich, Thanks for the reply. Apologies for the base64 code. I had forgotten to line break them when i replace the content. regarding the two 'content-type' headers, any idea under what circumstances the email will have 2 of such headers? I had tried crafting a custom email header with 2 or more content-type headers and inject it to the exchange server via telnet. it appears that the Exchange server will accept only the last entered conten-type and refuses to have 2 headers.
July 12th, 2011 4:27am

can i also ask why did the Content-Transfer-Encoding change from Base64 in the original msg and become quoted-printable without decoding? for the same email received by a Exchange 2003 mailbox, the Content-Transfer-Encoding was changed to quoted-printable, but the contents was also decoded to plaintext.
Free Windows Admin Tool Kit Click here and download it now
July 12th, 2011 4:53am

On Tue, 12 Jul 2011 08:19:14 +0000, hayami.wai wrote: > > >Hi Rich, > >Thanks for the reply. Apologies for the base64 code. I had forgotten to line break them when i replace the content. > > > >regarding the two 'content-type' headers, any idea under what circumstances the email will have 2 of such headers? That should never happen in the RFC2822 headers. It's wrong. >I had tried crafting a custom email header with 2 or more content-type headers and inject it to the exchange server via telnet. it appears that the Exchange server will accept only the last entered conten-type and refuses to have 2 headers. --- Rich Matheisen MCSE+I, Exchange MVP --- Rich Matheisen MCSE+I, Exchange MVP
July 12th, 2011 10:58pm

On Tue, 12 Jul 2011 08:44:54 +0000, hayami.wai wrote: > > >can i also ask why did the Content-Transfer-Encoding change from Base64 in the original msg and become quoted-printable without decoding? Because the MIME preamble is supposed to be just text, not encoded text. Surround the base64-encoded string with the correct MIME separator, MIME headers, and MIME terminator and see if it works. >for the same email received by a Exchange 2003 mailbox, the Content-Transfer-Encoding was changed to quoted-printable, but the contents was also decoded to plaintext. Exchange 2003 did a lot of odd things with inbound messages. It accepted messages that Exchange 2007 rejects (correctly) as having invalid formats. --- Rich Matheisen MCSE+I, Exchange MVP --- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
July 12th, 2011 11:03pm

really appreciate your effort in helping. since that the original.eml contains two Content-Type entries, is possible that there is problem with the local Exchange server or how the sender actually sends the mail? seeing that since it should never happen in RFC2822 headers but it has indeed happened now. i need to find out why/how this happened so that i can answer to the users inorder to proceed with the migration to Exchange 2010 =(
July 13th, 2011 12:31am

On Wed, 13 Jul 2011 04:20:56 +0000, hayami.wai wrote: > > >really appreciate your effort in helping. > >since that the original.eml contains two Content-Type entries, is possible that there is problem with the local Exchange server or how the sender actually sends the mail? The message contents were from the original e-mail as captured by pipeline tracing. Exchange hasn't added anything except the X-headers at the beginning of the message. >seeing that since it should never happen in RFC2822 headers but it has indeed happened now. I'd bet it's been happening all along. Having two Content-Type headers is wrong even if the message is accepted. >i need to find out why/how this happened so that i can answer to the users inorder to proceed with the migration to Exchange 2010 =( "It" happens because what you think is a MIME body part isn't one at all. It a problem the sender needs to correct, not you. --- Rich Matheisen MCSE+I, Exchange MVP --- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2011 9:35pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics