CreateMHTMLBody supported in .Net 1.1?

G

Guest

I'm writing a .Net 1.1 app that needs to send emails with the body being
formed by a locally served web page. Easy to do in legacy ASP. I found that
apparently CreateMHTMLBody is not supported via normal System.Web.Mail
constructs. It doesn't show up as a method on a message created this way. I
found a couple of posts that talked about adding references to CDO for
Exchange 2000. I did that and now VS2003 is giving me a correct method of my
message object to use CreateMHTMLBody. HOwever, when I run the code I get
"Unknown error" returned from the COM object. I've verified that the URL
being used is correct (copied it right out of the debugger and pasted it into
IE). I've tried both HTTP and File URLs. The HTTP URL returns the "Unknown
error" and the File URL returns "Must be an HTML file". The File URL is
"File://C:\inetpub\wwwroot\myapp\mailfile.htm".

Anyone have any ideas how to make this work? While I could use the
workaround I've seen posted to read the file into the HTMLBody as a string,
that results in sending URLs to embedded graphics that we'd rather not
publish.

Any help is greatly appreciated.
 
J

John A. Bailo

MailMessage Mailer = new MailMessage();
Mailer.BodyFormat = System.Web.Mail.MailFormat.Html;
 
G

Guest

MailMessage Mailer = new MailMessage();
Mailer.BodyFormat = System.Web.Mail.MailFormat.Html;

.... and then Mailer.HTMLBody=strBody; That's a different method with
different output.

Setting the Message Body type to HTML and setting the message body to a
string of HTML is not the same as using CreateMHTMLBody.

Setting the Body Type to HTML and setting the HTML Body to a string results
in emails that reference images directly on a web server. We're sending
emails where we do not want the graphics in the emails to be referenced
directly by the users.

The CreateMHTMLBody method takes a web page (either HTTP or File URL) and
converts it to an HTML multi-part message. Any graphics referenced through
IMG tags are attached to the message and the IMG tags are converted to CID
tags to reference the attached graphic.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top