Click here to Skip to main content
15,884,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can i make whole document with text,images and format of word document as email body.

I did this way, which gives only Text from word document and format is also changed.

C#
Word.Document wordDoc = wordApp.Documents.Open(filename, ref oMissing, ref  oTrue, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
                    Word.Range range = wordDoc.Content;
                    range.Select();
                    string msg = range.Text;
                    message.IsBodyHtml = true;
                    message.Body = msg;
                    wordDoc.Close(ref oMissing, ref oMissing, ref oMissing);

Any idea to achieve this.Kindly suggest me.
Posted

 
Share this answer
 
v5
Comments
keerth516 10-Aug-13 3:01am    
hi ridoy, thanks for the reply.one of the link you provided http://www.aspose.com/docs/display/emailnet/Using+a+Microsoft+Word+Document+as+the+Message+Body+and+Sending+Email says it is possible to convert whole document as email body.but am implementing this logic in windows application where as they have used MailMesssage from system.web.Mail. Is it correct way of applying in windows application?
ridoy 10-Aug-13 3:12am    
If you want to use system.web.Mail in windows application then you need to add reference from system.web probably.But you can try with System.Net.Mail for same work also.
keerth516 10-Aug-13 9:02am    
I couldn't find MailMessage.Load() in System.Net.Mail.I will try with System.Web.Mail and let you know.
You can not make a word document email body. You have only 2+1 options:
- plain text
- html (restricted css, no javascript): http://www.thinksend.com/faq/design-restrictions[^]
- TNEF (this is used when you send RTF with Outlook and Exchange). This would be the nearest to what you desire, but be aware, that this is a really special one. Read this: http://en.wikipedia.org/wiki/Transport_Neutral_Encapsulation_Format[^]. I am not sure you will be able to use such format without having exchange server as backend.

As what you want to achieve is platform and vendor-specific, I suggest you forget this approach: create two bodies: plain text and simple html and simply add the word document as attachment.
 
Share this answer
 
Comments
praejaz 30-Jan-14 5:53am    
i want to send word file as body of an email, can any one help me how to do it.
i am using visual studio 2008
Zoltán Zörgő 30-Jan-14 12:18pm    
Tsis is a long time open topic. Please open a new one by asking a new question. But I could not answer anything else than to this question.

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