We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

.NET OCX Is Required to Show MSG/EML File in Application

Hi,


I am looking for an OCX component to show MS Outlook mails (i.e. *.msg file) in one of our application.

Currently, we are supporting different file format (MS Office, pdf, txt, htm, etc.) using 3rd party OCX components. Now, we are thinking to extend it for Email messages too. For this I found your product feasible. But not fitting exactly in my solution.

Could you please suggest that if you have any such OCX component to support Emails?

Thanks,
Nizam.

Mohd Nizamuddin
Technical Leader
TRIPLE POINT TECHNOLOGY
+91.20.3020.6038 | desk
www.tpt.com
<span style=“font-size:8.0pt;font-family:“Arial”,“sans-serif”;
mso-fareast-font-family:“Times New Roman”;mso-fareast-theme-font:minor-fareast;
color:#00338D;mso-fareast-language:EN-ZA;mso-no-proof:yes”>
<span style=“font-size:8.0pt;font-family:“Arial”,“sans-serif”;
mso-fareast-font-family:“Times New Roman”;mso-fareast-theme-font:minor-fareast;
color:#00338D;mso-fareast-language:EN-ZA;mso-no-proof:yes”>WE KNOW SHIPPING.

Hi Nizam,


Thank you for considering Aspose.Email.

I am afraid to share that Aspose.Email doesn’t have any OCX component or graphical user interface for displaying Outlook as well as other mail messages. Aspose.Email is a library for manipulating (creating, reading, updating, saving) email messages as well as sending/receiving emails using the well known protocols (SMTP, IMAP, POP3, Exchange Server formats) programatically. You can learn more about Aspose.Email by having a look at Product Overview page. We also have a detailed online programming guide that contains detailed examples.

Please let us know if you have any other query/inquiry related to Aspose.Email. We’ll be glad to assist you further.
Thanks Kashif for your quick reply.

Does Aspose.Email provide a feature, using that I can save MailMessage into an RTF file?

I saw that MailMessage has a Save() method, but unfortunately, it does not have saving option to RTF.

If it does not exists, what are the efforts, timeline and cost to provide the feature.

Thanks,
Nizam.

Hi Nizam,


Aspose.Email provides MailMessage as well as MapiMessage for manipulating MSG files, where MapiMessage can be loaded from MailMessage as well. You can use MapiMessage to write RTF body to file as in the following code. Please let us know if we can be of any additional help to you in this regard.

Sample Code:


MapiMessage msg = MapiMessage.FromFile(“test.msg”);


// save in rtf file

StreamWriter writer = new StreamWriter(“test.rtf”, false);

writer.Write(msg.BodyRtf);

writer.Close();

Kashif,

Well, looks like we are heading to the target.

I tried your sample code. It is working well for the RTF text but it is eating up all the embeded images and formatting.

Please advise.

Regards,
Nizam.

Hi Nizam,


Thank you for the feedback.

Well, I was also not able to include the images in the output RTF file and need little more time to investigate this issue thoroughly. However, in the meantime, you can achieve this using a combination of Aspose.Email and Aspose.Words for .NET. First, Aspose.Email is used to convert and save the MailMessage in MHTML format and, then, Aspose.Words is used to load and save the MHTML as RTF. Please have a look at the following code sample and let us know your feedback.

Sample Code:

MailMessage msg = MailMessage.Load(“Message with inline image.msg”);<o:p></o:p>

//save the MailMessage to stream in MHTML format

MemoryStream ms = new MemoryStream();

msg.Save(ms, MailMessageSaveType.MHtmlFormat);

//Now use Aspose.Words for loading this stream and creating a RTF file

Document doc = new Document(ms);

doc.Save("A.rtf", Aspose.Words.SaveFormat.Rtf);

Hi Kashif,


I am using following code for saving it to MHT directly and found that MHT file itself incomplete.

I am dealing with Outlook message whose size is less than 1 MB (having only embedded images and text).

It would not able to embed objects at the end, when my mail contains a lot of embedded images (mostly at the end). So it skips few images at the end and put only placeholder for the embedded object, leaving an empty rectangle.

Aspose.Email.Mail.MailMessage msg = Aspose.Email.Mail.MailMessage.Load(@“C:\MyMessage.msg”, Aspose.Email.Mail.MessageFormat.Msg);

msg.Save(@“C:\MyMHT.mht”, Aspose.Email.Mail.MailMessageSaveType.MHtmlFormat);

Moreover, I tried via MemoryStream too but no benefit.

I have attached msg and mht files for your reference. This is just a reference I created a mail to show you. Unfortunately, the size of these test mails is > 3 MB.

Originally, I am using mails which has multiple small images. So the size of mails is less than 1 MB.

Regards,
Nizam.

Hi Nizam,


I have tested your provided sample file at my end and all the images are included in the output MHT/MHTML. It seems you are being effected by the licensing limitation which allows only 3 embedded images to be part of output MHT.

In order to evaluate Aspose.Email without any evaluation limitations, you can get a 30-day free trial license by requesting it HERE. Once you get a temporary license, you can set the license in your application as explained on our Licensing page. Please note that license initialization should be the first call in your application before any usage of API. Let us know if we can be of any additional help to you in this regard. We’ll be glad to assist you further.

Hi Kashif,

Thanks a lot for your support.

Things are working as per our requirement atleast.

Could you please assist me about the licensing, wheather can I distribute Aspose.Email.dll along with my appliation to our clients.

If yes, what type of license should be feasible for me. So that I can pass it to my license procurment team along with the price.

Thanks,
Nizam.

@nizamuddinmohd

You may please refer to the following article to protect your license from being leaked or stolen:
License Protection .

Feel free to write us back if you have any other query in this regard.