Using ASP.NET…
I have an email button on a popup extender and would like to use the inner html of another aspx page to use for the body, then edit a couple tags before it is sent. Is this possible?
Basically I’m using the .Net.Mail.MailMessage to create an HtmlBody and want to grab the html of another page (without actually rendering the page) as opposed to recreating it in a string.
First of all creating html emails doesn’t allow for complicated html (internal,external styling, and other controls) see…
Html Email Guidline.
So what I did was use the following to create an html string for emailing…
1) Create a simple .htm file as a template, formatting everything in standard html tables (not asp:tables), and other standard html tags.
2) Only use in-line styling if necessary.
3) Then create replacable text words or phrases to replace. You can also use a comment to replace text or for adding to a table see markup below
4) Then from a button in code behind you need to get the .htm page as string and replace the text with values you want
5) Return this string to the .Net.Mail.MailMessage.Body and send it out as you normally would. Make sure to set MailMesage.IsBodyHtml = True
You could also create the entire string using StringBuilder without using a template.