Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting HTML page into an email
Message
 
 
To
27/01/2009 11:36:48
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01377350
Message ID:
01377366
Views:
15
>>This is completely new to me. Is CDO namespace part of .NET framework? Do you create your HTML page and then use this CDO.Message to convert it? It would be helpful if you could provide pseudo steps you perform in this process (in a brief summary). Thank you.
>
>I will have an article on this in the upcoming Level Extreme .NET Magazine. In overall, it's pretty simple. You simple add the namespace in your class. Then, you call the CreateMHTMLBody() method with the URL. That will save it to where you have indicated it. The following example is a short summary. It only includes the basic stuff:
>
>
>Imports CDO
>Imports ADODB
>
>    Public Class MHTML
>
>        Public cMHTMLUrl As String = ""
>        Public cSaveFile As String = ""
>
>        ' CDO message object
>        Private oMessage As CDO.Message = New CDO.Message
>
>        ' Get the MHTML file
>        Public Function GetMHTML() As Boolean
>            Dim llSuccess As Boolean = False
>            Dim loStream As ADODB.Stream
>
>            ' Go get the page
>            oMessage.CreateMHTMLBody(cMHTMLUrl, CDO.CdoMHTMLFlags.cdoSuppressNone, "", "")
>
>            loStream = oMessage.GetStream()
>
>            ' Save to file
>            loStream.SaveToFile(cSaveFile, SaveOptionsEnum.adSaveCreateOverWrite)
>
>            llSuccess = True
>            Return llSuccess
>        End Function
>
>    End Class
>
>
Thank you very much for the sample code. And I will look for the article when it comes out. If I may ask you one more question, please After you save the resulting code to a file (as pointed in your code), how do you attach it to an email message? When I attach a file to an email message (I use Outlook), the attachment goes as attachment. But I would want this saved file to be the body of the email message.

PS. If you have a draft of the article you plan to publish in .NET Magazine and want someone to proof read it, please email it to me; I will be glad to proof read it {g}.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform