1

I want to verify email body content in .eml files saved to disk. I have added the following section to my App.config file:

<system.net>
    <mailSettings>
        <smtp deliveryMethod="SpecifiedPickupDirectory">
            <specifiedPickupDirectory pickupDirectoryLocation="d:\temp\emails\"/>
        </smtp>
    </mailSettings>
</system.net>

Sometimes some of the body content in the .eml file is saved incorrectly. I have some values that are being saved with double decimal points

Example:

ABC, XYZ, 2.00, 0..19609, 0.2117772

When I take out the config section and the email is sent to my outlook inbox, I do not get this issue. Example:

ABC, XYZ, 2.00, 0.19609, 0.2117772

It is always the same values that are correct and incorrect. I wouldn't expect that the saving of a file would modify content. Any help on what might be happening here would be much appreciated.

Mike
  • 827
  • 11
  • 27

1 Answers1

0

As I understand it, this is to be expected as the file produced is not supposed to be a straight copy but rather follow the rfc822 spec (see http://www.w3.org/Protocols/rfc822/3_Lexical.html).

If you want to compare the file output with your input, then I think you will need to find/write a routine to decode the rfc822 back to plain test.

sgmoore
  • 15,694
  • 5
  • 43
  • 67
  • Thanks for the information. That is useful to know and it does seem that this spec shows the decimal point as a special character. I am currently looking for a c# routine to decode rfc822 back to plain text if anybody knows of one. I noticed that when I open the .eml file in notepad the the following header was set "Content-Type: text/plain; charset=us-ascii". – Mike Sep 26 '12 at 11:01
  • See http://stackoverflow.com/questions/936422/recommendations-on-parsing-eml-files-in-c-sharp – sgmoore Sep 26 '12 at 11:46
  • Thanks for the link. I can't use the accepted answer in this link as a solution as I'm running Windows 7. I am actually using the LumiSoft Mime parser mentioned but this has the doudle decimal point issue in the mimeEntity.DataText property. It's probably worth trying different mime parsers mentioned in the link. – Mike Sep 26 '12 at 13:49
  • I've tried to use another Mime parser in the link provided (Sasa) and got the same issue. I looked for code to decode the rfc822 back to plain test without any luck-Used: http://www.codeproject.com/Articles/11380/A-C-Implementation-of-Mime-De-encode When I opened the .eml file with notepad, the double decimal point issue only appeared for values where the first character of the line was a decimal place. Example: ABC, XYZ, 2.00, 0= ..19609, 0.2117772, For now I resorted to a hack (emailLineRead.Replace("..", ".")) to remove the unexpected behaviour but this is obviously not what I want to do. – Mike Oct 01 '12 at 12:43
  • 1
    Maybe I am getting mixed up with my rfcs. See http://stackoverflow.com/questions/6602318/system-net-mail-creating-invalid-emails-and-eml-files-inserting-extra-dots-in-h – sgmoore Oct 06 '12 at 17:42
  • Thanks for the link. This is exactly the information I was looking for. I got side tracked with other work and didn't see your update until now. – Mike Oct 11 '12 at 11:08