Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send the current page as mail or get the Current page html

Tags:

c#

email

asp.net

I need to send the current page content as a mail. Any Idea How we can Do that. My Idea is to get the html code of the page and send it as such. But Don't know how to get the html code of the page.

like image 753
Anish John Avatar asked Dec 01 '25 02:12

Anish John


1 Answers

If you want to get HTML of your page server side so that you can mail it, Try this

StringWriter str_wrt = new StringWriter();
HtmlTextWriter html_wrt = new HtmlTextWriter(str_wrt);
Page.RenderControl(html_wrt);
String HTML =  str_wrt.ToString();
like image 126
yogi Avatar answered Dec 02 '25 15:12

yogi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!