Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attach HTML string in email

Status
Not open for further replies.

grande

Programmer
Feb 14, 2005
657
CA
Hi again,

So, until recently, I've been sending emails for my client by just throwing HTML into the body of the email. They now want the HTML page to be sent as an attachment. I'm wondering how I can take the HTML code that I have (currently stored in a string) and attach it to the file.

Here's what I'd like it to do:
Code:
string strHTML = BuildHTML();
email.Attachments.Add(new SmptAttachment(strHTML as HtmlFile);

(If only it were that easy...)

Hope I've explained it well,
Thanks.

-------------------------
Call me barely Impressive Captain.
 
The following steps come to mind:

- save the html string to a .htm file (using a streamwriter)
- attach the file to your mail
(- delete file when mails have been send)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top