Display a saved .msg message as HTML or ASP.NET - c#

I have a problem. I need a way to import a saved .msg file from Outlook and then display this as html.
Ideally I would have an ASP:FileUpload control that the user would upload the email. Then I would want to parse this as markup so the email can be displayed in the website. I just don't know how to go about pulling this email message in and passing it as a new MailMessage object.
If I could bring the data from the file upload in as a new MailMessage object I would imagine I could read the information from the file and display this.
There has to be a way to display the contents of a .msg with C#. I can't imagine there isn't. I would REALLY like to not use third party plug-ins or .dll files. I have a feeling C# has this functionality somehow built into it. (maybe include one of the references?)

Have you considered using a third-party library to load the MSG file, and then retrieve the content of the message? Aspose.Email can probably do that for you.

Related

Programmatically create an embedded file attachment

When I use Microsoft Outlook, it allows me to place file attachments in the body of the email rather than just attach them to the message. Is there a way to replicate this behavior using an HTML formatted email in C#? I am sending an automated email out with lots of attachments and it would help keep everything organized for the end user. I found ways to embed an image file into the email but not how to put attachments in. I believe these are called "inline" or "embedded" attachments.
No, HTML will only let you have embedded images.
RTF actually inserts icons inside special placeholders in the RTF body.
The icon position is specified by the Position parameter when calling Attachments.Add.

Show .MSG file with Outlook in C# application?

Is there a way (some specific COM object) which can be integrated into your app window and render the content of .MSG file? There are solutions for parsing .MSG files but I'd like to easily display it. Emails with tables, links and especially images are very tricky to render correctly - as I understand, only Outlook is able to render is accurately in a shape user is accustomed to.
Even Preview Handler cripples email formatting - you can notice it in Windows Explorer's Preview Pane. I guess the only reliable solution is to ask Outlook to render it for you...
You may consider automating Outlook to display the .msg files. See How to automate Outlook and Word by using Visual C# .NET to create a pre-populated e-mail message that can be edited for more information.
Also you may consider using third-party components for getting the job done.

Manipulate and process email

I am using Thunderbird and I need to somehow manipulate and process the e-mails that are stored in inbox.msf file using C# language. In C# I am using SS2.Pop3 library.So, I was wondering, how do you parse an .msf file?
.msf files are mail summary files and do not contain emails (admittedly, it's been like 10 years since I looked). Thunderbird uses standard UNIX mbox formatted files to store mail.
There is only 1 parser for those files available in C# and that is MimeKit (which also happens to be my library).
I'm pretty sure that if you have an Inbox.msf file, right next to it should be a file called Inbox which has the actual mail in it. That's the file you want to parse.

Can we Embed an Image to a Email without using HTML?

I want to send an e-mail consisting an image from my C# program. I can completely do that using the code samples at How to Send Mails from your GMAIL Account through VB.NET or C#. Windows Programming, with a Bit of Customization
But when I used another email service, they just remove the HTML tagged part including the image from the email! So does anyone know a method to embed the image without using HTML tags?
Thanks in advance.
perhaps you can send it as an attachment?
Can that be an option for you?
There isn't really any way to do that other than the old:
send as attachment
just paste the full (or shortened) link into your content body

Show mail message in WebBrowser control

I'm trying to design a mailing system (.NET C#).
Messages are stored in database in two tables:
message(Message_id, Receiver, Sender, Subject, ...) //message's header
message_parts(Message_id, Content_id, Part_type, Content)
So, the content of message is divided into parts (html body, plain text body, sources for html, attachments)
I can't find a way how could i display the message in the WebBrowser control in case when I have html with embedded images. I will have html that references images by content id, i will have images encoded in base64. Now how can I link them and display?
The only ideea that comes to me is building an mht file and open it in the WebBrowser.
But besides that i can't figure out how to do this too, the last thing i want is to create files on the local system.
So, the questions are:
how can I display a message broken into parts as explained above?
how to build an mht file having these parts?
maybe it's not a WebBrowser I should use, but some UI control that does the work for me?
Thank you!
You could create the mht file and set the mimetype to multipart/mime.
Here is a webpage which has some code to create MHT (possibly relying on dlls you need to install separately): http://www.eggheadcafe.com/articles/20040527.asp
Perhaps this might be helpful too: http://msdn.microsoft.com/en-us/library/aa488379(EXCHG.65).aspx

Categories

Resources