none
[E2010] [EWS] [C#] EmailMessage.MimeContent contains modified HTML instead of original RRS feed

  • Question

  • Hi,

    I'm implementing DKIM verification of emails in C#, however it seems that the exchange API doesn't provide any way to obtain the raw email.

    The closest I was able to find is EmailMessage.MimeContent.Content, which is still somewhat modified sometimes, even when setting the PropertySet with:

    • ConvertHtmlCodePageToUTF8 = false;
    • FilterHtmlContent = false;

    It seems that the HTML body of multipart emails is the usual part that gets modified. The DKIM signature verification fails because of that.

    Example of raw original email body (truncated the headers):

    MIME-Version: 1.0
    
    --_000_AM5PR0301MB2338C71434EA0737156D010D98EF0AM5PR0301MB2338_
    Content-Type: text/plain; charset="iso-8859-1"
    Content-Transfer-Encoding: quoted-printable
    
    vrevre
    
    --_000_AM5PR0301MB2338C71434EA0737156D010D98EF0AM5PR0301MB2338_
    Content-Type: text/html; charset="iso-8859-1"
    Content-Transfer-Encoding: quoted-printable
    
    <html>
    <head>
    <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
    1">
    <style type=3D"text/css" style=3D"display:none;"><!-- P {margin-margi=
    n-bottom:0;} --></style>
    </head>
    <body dir=3D"ltr">
    <div id=3D"divtagdefaultwrapper" style=3D"font-size:12pt;color:#000000;font=
    -family:Calibri,Helvetica,sans-serif;" dir=3D"ltr">
    <p style=3D"margin-margin-bottom:0">vrevre</p>
    </div>
    </body>
    </html>
    
    --_000_AM5PR0301MB2338C71434EA0737156D010D98EF0AM5PR0301MB2338_--

    And this is what the EWS API provides:

    MIME-Version: 1.0
    
    --_000_AM5PR0301MB2338C71434EA0737156D010D98EF0AM5PR0301MB2338_
    Content-Type: text/plain; charset="iso-8859-1"
    Content-Transfer-Encoding: quoted-printable
    
    vrevre
    
    --_000_AM5PR0301MB2338C71434EA0737156D010D98EF0AM5PR0301MB2338_
    Content-Type: text/html; charset="iso-8859-1"
    Content-Transfer-Encoding: quoted-printable
    
    <html><head>
    <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
    1">
    <style type=3D"text/css" style=3D"display:none;"><!-- P {margin-top:0;margi=
    n-bottom:0;} --></style>
    </head>
    <body dir=3D"ltr">
    <div id=3D"divtagdefaultwrapper" style=3D"font-size:12pt;color:#000000;font=
    -family:Calibri,Helvetica,sans-serif;" dir=3D"ltr">
    <p style=3D"margin-top:0;margin-bottom:0">vrevre</p>
    </div>
    </body>
    </html>
    
    --_000_AM5PR0301MB2338C71434EA0737156D010D98EF0AM5PR0301MB2338_--

    Notice the difference at the start of the HTML, a carriage return went missing.

    Is there any way around that, or possibility to submit a bug report somewhere?

    Thanks


    • Edited by Raphlau Tuesday, January 23, 2018 1:24 PM typo
    Tuesday, January 23, 2018 1:23 PM