Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Dear All,

Task: How to convert single mail content to word document in asp.net, C#. My client using "Lotus Notes" mail server for send and receive mail.

I have to complete this task ASAP.

I welcome for your valuable suggestions or ideas that might be helpful for me.
Thank you very much in advance.
Posted
Updated 25-Jun-14 21:22pm
v3
Comments
Did you try any techniques yet?

1 solution

First, you need to parse the content of mail message. For this purpose, you need to write code not available in .NET FCL, or find some 3rd-party library. I would recommend open-source OpenPOP.NET: http://hpop.sourceforge.net[^].

This library is not very well written, but it thoroughly follows all those standard for mail structure, headers and MIME types. The complexity of all of this stuff is due to the big variety of different content types, dispositions and also due to multi-part content (with different content type and content disposition for every part.

To create Word documents, you can use either use Office Interop assemblies, or, better, Microsoft Open SDK. Actually, Microsoft warns against using Office Interop in server environment:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2[^],
http://support.microsoft.com/kb/257757/en-us[^].

On Open XML SDK, please see:

http://www.microsoft.com/en-us/download/details.aspx?id=30425[^].

This way, you can support new XML-based Office formats (such as .DOCX, .XLSX), ECMA-376 standard:
http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats[^],
http://en.wikipedia.org/wiki/Office_Open_XML[^].

This way, you can work without Office installed. Also, the documents are supported by 3rd-party software. Please see my past answers:
Convert Office-Documents to PDF without interop[^],
Need a rather unique WPF text editor control[^],
Hi how can i display word file in windows application using c#.net[^],
Read a word file without using Interop.word dll...Do not want to install word in IIS..[^].

This is another option: http://npoi.codeplex.com/[^].

See also:
 
Share this answer
 
Comments
Bhanu Pratap Verma 27-Jun-14 7:34am    
Thank Sergey Alexandrovich.
Can it be possible with out third party tool. Actually I need to do with c# code.
Sergey Alexandrovich Kryukov 27-Jun-14 11:46am    
Of course it is possible without 3rd-party library. It will be the library you write yourself. Mail standards are publicly available, and Microsoft is not a 3rd party relative to Office. But, in this case, why asking a question at all? You are already using a "3rd-party tool" — CodeProject.

And 3rd-party open-source library can show you what work you are going to do. In all cases, if you expect more instructional answer on how to do the work, the answer itself will become a "3rd-party tool", but it would not be realistic to expect it, for such a big work. Isn't that logical?

So, are you going to accept this answer formally (green "Accept" button)? Of course, in all cases, your follow-up questions will be welcome.

—SA
Bhanu Pratap Verma 10-Jul-14 8:50am    
Hi my client using "Lotus Notes" for email, I need to export email to word and save in database.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900