2 problems with LumiSoft.Net class

Last post 11-07-2009 3:55 PM by mohsinaeem. 1 replies.

Sort Posts:

  • 2 problems with LumiSoft.Net class

    11-07-2009, 3:18 PM
    • Member
      point Member
    • adrub
    • Member since 11-05-2009, 2:40 PM
    • Posts 3

    This is my code:

    Mail_Message mailMessage = Mail_Message.ParseFromFile(emailPath); //emailPath  - it's path to .eml file on my disk
    ....
    .... //I'm sending here mailMessage to method, which is saving this e-mail in my db
    ....
    mailMessage.Dispose();


    File.Delete(emailPath); //here I want to delete this file from my disk


    I have two problems:

    1. Problem with deleting files.

    In line "File.Delete(emailPath);  I've got an error, that this file is using by another program, and I can't remove it from my computer. If I want delete it using windows explorer, there is the same error.

    Why? I wrote "mailMessage.Dispose()" ...

    I'm sure that this line:

    Mail_Message mailMessage = Mail_Message.ParseFromFile(emailPath);
    causes problem.


    2. My messages are not formatted
    mailMessage.BodyHtmlText = null
    and my message is no formatted. Everything is in one line, the same font, and so on....

    When I open .eml file in outlook express it will look good. It will be formatted correctly.

    Has anyone any idea? What can I do?

    Grzegorz.

  • Re: 2 problem with LumiSoft.Net class

    11-07-2009, 3:55 PM
    • Contributor
      2,236 point Contributor
    • mohsinaeem
    • Member since 05-08-2008, 3:41 AM
    • Fort Lauderdale, FL
    • Posts 336

    I would say use EMLReader class from the article given below for reading the eml. Also remember one always try to use "Using" block for reading files then you don't need to explicitly call Dispose method.

    EMLReader Article:
    http://www.codeproject.com/KB/office/EML_Reader.aspx

    Using Block Sample:
    http://www.c-sharpcorner.com/UploadFile/DipalChoksi/UsingStatement11092005065819AM/UsingStatement.aspx
    http://www.aspfree.com/c/a/C-Sharp/C-Sharp-StreamReader-and-StreamWriter-Explained/2/

    Mohsin Naeem
    MCPD 2.0, MCTS (SharePoint 2007, SQL Server 2005)
    "Please mark as answer if it helped you"
Page 1 of 1 (2 items)