HTML Encoded Email

  • Thread starter Thread starter Andrew Robinson
  • Start date Start date
A

Andrew Robinson

I used to use the old CDO.Message.CreateMHTMLBODY() method to encode a web
page and send it as an email. Encoding HTML is pretty simple but when you
have associated images CDO.Message was the way to go.

I never found an easy way to do this with version 1.x of the framework. Is
there anything in 2.0 that will do this or do I still need to interop with
CDO?

Thanks,

-Andrew
 
System.Net.Mail namespace. You will love it!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.
 
I have been playing around with it but could you post a simple but specific
example of how to do this (encode and embed a web page as HTML within and
email.)

Thanks,
 
I have been playing around with it but could you post a simple but specific
example of how to do this (encode and embed a web page as HTML within and
email.)

I'm not following you. The MailMessage class has a boolean property called
IsBodyHtml, which will send the body as HTML. The only other difference
would be in the text of the body. Example:

This is a plain text body.

<html>
<body>
This is an HTML text body.
</body>
</html>

Text is not encoded, nor is it embedded. It's just text. If you want to read
it from a file, open the file as text, and read it into a string.

Am I missing something here?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.
 
CDO.Message.CreateMHTMLBODY() allows to encode and embed all images on a
target web page. I typically build a web page with images and then point at
it to create my email.

I realize that I can code simple or even complex html but how do you include
images with your solution? I am assuming as some type of attachement? The
page needs to render when the end user reads the email.

-Andrew
 
Hi,

Currently I am researching the issue and we will reply here with more
information as soon as possible.
If you have any more concerns on it, please feel free to post here.

Thanks for your understanding!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Andrew,

Including images in an HTML email document can be as simple as using an
absolute URL for the image tag, as in:

<img src="http://www.ietf.cnri.reston.va.us/images/ietflogo.gif">

Or it can get more complex, by using a multi-part Content format for your
email message, with attachments, and references in the HTML to locations
within the document itself. While I have yet to implement this, it should
not be difficult. The IETF specifies the various methods for embedding image
and other binary data in HTML emails, and using them in the HTML body of the
email, in RFC 2557:

http://www.apps.ietf.org/rfc/rfc2557.html

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.
 
Kevin,

Thanks for all the info. I do need to embed images. CDO did this for me
automatically. I am sure it will be an interesting "learn" but was hoping
someone else had already done it.
 
Hi Andrew,

I'm sure somebody else has. I just don't know who. Your question prompted me
to put it on my own "TO DO" list, but it may be awhile before I get around
to it. I have built a Mail Client class that encapsulates the SmtpClient,
MailMessage, and a bunch of other related classes and functionality,
providing a less-intimidating programming interface (similar to CDO), but
hadn't thought of that. So, I will definitely be putting it in when I have
the chance. I also bookmarked the RFC.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.
 
Hi

Based on my researching, there is no such a counterpart in .NET 2.0 for
CreateMHTMLBODY.
If you do want the feature, I think you have to use CDO approach.
Thanks for your understanding!


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top