 |
|
|
Actually I converted this code in C# and is working fine but its not going to save all web site just like ibnlive.com, Cricinfo.com..what can be reasons . If anyone know just tell me..I will be very thankful to him.
mail_id;-bishu_473@yahoo.co.in
bishwajeet
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi guys i created a function (C# .Net) to create a Mht file, and always work perfect, but randomly the file generated lost the format and look totally diferent of the source HTML, is to hard to replicate the error, please let me know if you have been heard about this problem, and if you know a posible solution.
Thanks X
this is the code i'm using:
public static void Create(string url, string path, string fileName) { // Create in memory MHT MessageClass message = new MessageClass(); message.CreateMHTMLBody(url, CdoMHTMLFlags.cdoSuppressNone, "", ""); string mht = message.GetStream().ReadText(message.GetStream().Size);
// Verify path System.IO.DirectoryInfo directory = new DirectoryInfo(path); if (!directory.Exists) directory.Create();
// Write MHT file FileInfo file = new FileInfo(path + "\\" + fileName); StreamWriter writer = file.CreateText(); writer.Write(mht); writer.Close(); }
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
Are there any known issues with Windows 2003 SP2's version of CDOSYS? I have an application that uses CreateMHTMLBody that no longer works on my development machine since we upgraded to SP2. It is still working on our production machine which we haven't installed SP2 on yet.
I eventually get an HTTP 500 error on the web page. (Appears to just timeout) In the log file I have 202|8004004|operation_aborted_80.
The cdosys.dll has a date/timestamp of 2/17/2007 9:02am on my development machine. The production machine (one that works) has a date of 9/9/2005 9:32pm.
The application on the dev server will send text emails. It appears that just CreateMHTMLBody is broke.
Nancy
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hya. very new at mhtml. I need to format a mail in html format into mhtml. The html code incl. iframes and this is key. how can i do this?
I downloaded the html2mhtml but i cant see how to use it.
So 2 things.
How do i use the converter? and Can i use iframes in the html code i want to convert?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Im converting HTML file to DOC file using MHT, For embedding images and stylesheets in my word document. Hyperlink(with query string) in anchor tag is truncated automatically in word document, though length of URL is just 400 character. Is anyone have idea on this problem? or Some other feasible way to convert HTML to DOC embedding images and stylesheets.
|
| Sign In·View Thread·PermaLink | 3.00/5 (6 votes) |
|
|
|
 |
|
|
It would be really nice and helpful to build this converted into a standalone .NET library (DLL) that could be used from either web or win forms applications. Any intent to do so?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I am trying to generate MHT file from HTML. The code works fine if the Html to be converted is less.Once it gets bigger, then I am getting blank MHT file.Is there any size limit that MHT file is created using this code. How can i convert big HTML files into MHT file. Any help will be appreciated.
Sunil
|
| Sign In·View Thread·PermaLink | 1.67/5 (2 votes) |
|
|
|
 |
|
|
When i am trying to run the project that I downloaded, on clicking Convert button, I am getting error "External component has thrown an exception. " On debugging i found that it is throwing exception on "Dim msg As New CDO.MessageClass" statement. Exception message shows "[System.Runtime.InteropServices.SEHException] ". Any help regarding solving the problem will be appreciated.
Sunil
|
| Sign In·View Thread·PermaLink | 2.50/5 (2 votes) |
|
|
|
 |
|
|
from this article I can convert html to mhtml , but if I must convert a mthml file to a html file ,what should I do ? please help me! thank you !
|
| Sign In·View Thread·PermaLink | 1.33/5 (3 votes) |
|
|
|
 |
|
|
Did you get an answer?
I need to do this. We store mhtml in a database that can be read and displayed. Unfortunately, only IE supports viewing of these pages correctly. Therefore better to convert back to html for viewing.
Rik
Rik
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi, I want to convert an Url to an MHT file, so I try to use the convertWebPageToMHTString() method, and try the following test cases ... (1)If the Url is "http://", then the convert will be OK, (2)If the Url is "https://", then the convert will be Faild, and show me the "Security Error" Is there anyone can help me ?  Thanks A Lot, Best Regards,
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi, The following is the code I modified .. If If the Url is "https://", then the convert will be Faild, and show new Exception to the caller program ...
========================================= Try msg.MimeFormatted = True msg.CreateMHTMLBody(url, CDO.CdoMHTMLFlags.cdoSuppressNone, "", "") stm = msg.GetStream() Return stm.ReadText(stm.Size) Catch ex As Exception Throw New Exception(ex.Message) Finally If Not IsNothing(stm) Then stm.Close() stm = Nothing End If End Try
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi, I need to fax a report that is generated by my site. The report is an HTML page with some small graphic images. The fax vendor (InterFax.Net) recommends using .MHT. Currently, I get the report into a string using:
dim strgWriter as New System.IO.StringWriter server.execute("MyAspNetPageName.ASPX?someParam=value",strgWriter) dim sReport as string = strgWriter.ToString
The result is the HTML in the sReturn string which I simply send to InterFax using their web service. However, this leaves the <IMG> links as real links; it obviously does not embed the graphics.
The code presented here requires a "real" URL -- any idea how I can feed it the string? I'd very much prefer not to have to write a temporary file if possible.
Many thanks -- john
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
dim sReport as string = convertWebPageToMHTString("MyAspNetPageName.ASPX?someParam=value")
Magnus Persson
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
modify "convertWebControlToMHTString".
Replace the parameter "byval control As webControl" with "byval html As string" and remove the line "Dim html As String = getHtml(control)"
Magnus Persson
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
thanks!! We are now able to package up an HTML page w/ images and send it to Interfax.Net for faxing -- it works great; thank you!
Next question: we save the MHT to our database and would like to view it from inside the app. HTML data, we simply write it to the Response object using Response.Write(str). This doesn't work with this MHT data; the headers are displayed, etc. -- the browser (IE) does not seem to understand the content type. Do you have any ideas for what we may be doing wrong? Maybe something as simple as setting a header or Response.ContentType? Tried lots of combinations but haven't found the magic yet... TIA--john
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I used this function below to convert an auto-generated HTML file into MHTMl so that I can attach it to email and send it to other people. However the code did not work if I delete the images: the MHTML file did not render any imgae. Here is the code I used from previous post: C:\WINDOWS\SYSTEM32\cdosys.dll C:\Program Files\Common Files\System\ado\msado15.dll
=====================================================================
public void convertWebPageToMHTString(string url, string fileName) { CDO.MessageClass message = new CDO.MessageClass();
//The following method allows for a username and password //The last two parameters are for the username and password, respectively message.CreateMHTMLBody(url, CDO.CdoMHTMLFlags.cdoSuppressNone,String.Empty,String.Empty); ADODB.Stream stream = message.IBodyPart_GetStream(); stream.SaveToFile(fileName,ADODB.SaveOptionsEnum.adSaveCreateOverWrite);
}
Thanks alot
CodeBattles
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
If the URL passed to CreateMHTMLBody() contains spaces (possible in case of a file:// protocol) and cdosys.dll version is 6.2.4.0 then this code will not work; anyway it works fine with earlier versions of cdosys.dll.
lucian_davitoiu
-- modified at 12:18 Tuesday 18th April, 2006
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Thanks for replying. It could be because of the version issues since the codes from the author didn't work either. As soon as I deleted the images, they won't render on the page anymore. Another way to do this is MIME format. I got it done a while ago.
Thanks,
CodeBattles
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 Hi,
I got problem when I make a large MHTML file then mhtm is downloaded but nothing will be in file. Any body can help me how i increase that downloaded mhtml file size in Dotnet.
Nirdesh Puri
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi your article is very much useful to me. But now I am having a problem with attaching images in mail body.The story as follows!
For my CDO mail I am accessing multiple recipients addresses from one CSV file. At the same time I am adding a html file as body.If my HTMLfile contains any images(with IMG tag) The mail is perfectly going to first recipient.But for the second recipient, my mail is going with images in the body and additionally as attachments.For the second recipient,it's going like- mailbody with images + one same image as attachment.For third one, mailbody + 2 image attachments..... Though I haven't attached any.
I thought this is because my CDO object hasn't set to "nothing" after sending mail to first recipient. But if do this my mail don't go to second person. I am using
ObjCDOmessage.CreateMHTMLbody("file://\\" & Bodyfilename, CDO.CdoMHTMLFlags.cdoSuppressNone)
to set my mail body. How can I avoid images that are in my previous recipient's mail as attachments to my next person's mail?Please solve my Problem
Radhika Datla
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
Hi I am reading mail addresses from a CSV file .Fields are email address,recipient's name. I am sending code after setting CDO configuration and sender's address. First I read the body file contents to "strbody". Now
'********************start reading the contents of the address file from the specified location********
finaddr = 1 ncurrentLine = 0 nStartLine = CInt(txtstartline.Text) - 1 FileOpen(finaddr, OFD1.FileName, OpenMode.Input) If (nStartLine <> ncurrentLine) Then For itemp = ncurrentLine + 1 To nStartLine If (LOF(finaddr) = 0) Then MsgBox("Startline is greater than the address line") Exit Sub End If strFullLine = LineInput(Val(finaddr)) If (Len(strFullLine) = 0) Then MsgBox("address file empty") End If Next ncurrentLine = nStartLine
End If Do Until EOF(finaddr) strFullLine = LineInput(Val(finaddr)) If (Len(strFullLine) = 0) Then Exit Do End If vSpacePos = Microsoft.VisualBasic.InStr(strFullLine, ",") strEmailAddr = Microsoft.VisualBasic.Left(strFullLine, vSpacePos - 1) strName = Microsoft.VisualBasic.Mid(strFullLine, vSpacePos + 1) vSpacePos = Microsoft.VisualBasic.InStr(strName, ",") If (vSpacePos <> 0) Then strName = Microsoft.VisualBasic.Left(strName, vSpacePos - 1) End If strEmailTrimed = Trim(strEmailAddr)
Do While True vSpacePos = InStr(strEmailTrimed, " ") If (vSpacePos = 0) Then Exit Do End If strTemp = Microsoft.VisualBasic.Left(strEmailTrimed, vSpacePos - 1) strTemp1 = Microsoft.VisualBasic.Mid(strEmailTrimed, vSpacePos + 1) strTemp1 = Trim(strTemp1) strEmailTrimed = strTemp & strTemp1 Loop strEmailAddr = strEmailTrimed If (Len(strEmailAddr) = 0) Then Exit Do End If
'*********************Set the email to specified members in the address field**********************
oMsg.To = strEmailAddr oMsg.Subject = txtsubject.Text Dim myheader As String myheader = "Dear "
'**********************Open the bodyfile to add custom Header and recipient's name*****************
FileOpen(finbody, OFD2.FileName, OpenMode.Output) Print(finbody, myheader & strName & "" & " ," & "" & vbCrLf & strBody) FileClose(finbody) 'MsgBox(strBody) Dim Bodyfilename As String = OFD2.FileName 'MsgBox(Bodyfilename)
'*****************setting HTML mail body **********************************************************
oMsg.CreateMHTMLBody("file://\\" & Bodyfilename, CDO.CdoMHTMLFlags.cdoSuppressNone) '***************************************Sending the email*******************************************
oMsg.Send()
'************After sending mail, delete the custom header from our file body for not to be repeated 'in next recipient's mail body********************************************************************
temfinbody = 3 FileOpen(temfinbody, OFD2.FileName, OpenMode.Output) Print(temfinbody, strBody) SaveFileDialog1.RestoreDirectory = True FileClose(temfinbody) 'MsgBox(strBody)
'****Now deleting the attachments because they should not be repeated with the mail of the next recipient's address field****
If (Len(addattach.Text) <> 0) Then For counter = 0 To lstattachment.Items.Count - 1 oMsg.Attachments.DeleteAll() Next End If '******************************increment the loop to read the next addressee*******************************
GoTo skipped skipped: ncurrentLine = ncurrentLine + 1 icount = icount + 1 Loop StatusBar1.Text = " MAIL HAS BEEN SENT SUCCESSFULLY! NUMBER OF MESSAGES SENT: " & CStr(icount) strLastAddrFile = txtsendto.Text
'***********close the address file******************************************************************************** FileClose(finaddr) icount = 0 strBody = ""
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |