我有我的 aspx 页面的 html 部分,现在我需要将字符串作为电子邮件发送。问题是文本框值没有被保存。任何人都可以给我一些想法。谢谢你
这是我的代码。
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
StringBuilder sbOut = new StringBuilder();
StringWriter swOut = new StringWriter(sbOut);
HtmlTextWriter htwOut = new HtmlTextWriter(swOut);
base.Render(htwOut);
string sOut = sbOut.ToString();
// Send sOut as an Email
writer.Write(sOut);
MailMessage msg = new MailMessage(txt_From.Text, txt_To.Text);
msg.Subject = txt_Subject.Text;
msg.Body =Sout.ToString();
msg.IsBodyHtml = true;
SmtpClient yourSmptpclient = new SmtpClient("10.238.52.900");
try
{
yourSmptpclient.Send(msg);
}
catch (Exception Exp)
{
throw Exp;
}
}