Web Analytics Made Easy -
StatCounter code for email shows server error - CodingForum

Announcement

Collapse
No announcement yet.

code for email shows server error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • code for email shows server error

    following code, to send the email in asp.net shows server error,
    please resolve this error

    CODE ::


    MailMessage msg=new MailMessage();
    StringWriter strwriter=new StringWriter();
    HtmlTextWriter htmltxtwriter=new HtmlTextWriter(strwriter);

    htmltxtwriter.RenderBeginTag("html");
    htmltxtwriter.RenderBeginTag("head");
    htmltxtwriter.RenderBeginTag("title");
    htmltxtwriter.Write("thank you for registering");
    htmltxtwriter.RenderEndTag();
    htmltxtwriter.RenderEndTag();
    htmltxtwriter.RenderBeginTag("body");
    htmltxtwriter.WriteLine("thank you");
    htmltxtwriter.RenderEndTag();
    htmltxtwriter.RenderEndTag();

    msg.From="MailMessage msg=new MailMessage();
    StringWriter strwriter=new StringWriter();
    HtmlTextWriter htmltxtwriter=new HtmlTextWriter(strwriter);

    htmltxtwriter.RenderBeginTag("html");
    htmltxtwriter.RenderBeginTag("head");
    htmltxtwriter.RenderBeginTag("title");
    htmltxtwriter.Write("thank you for registering");
    htmltxtwriter.RenderEndTag();
    htmltxtwriter.RenderEndTag();
    htmltxtwriter.RenderBeginTag("body");
    htmltxtwriter.WriteLine("thank you");
    htmltxtwriter.RenderEndTag();
    htmltxtwriter.RenderEndTag();

    msg.From="hpc.com";
    msg.To=TextBox3.Text;
    msg.Subject="xyz";
    msg.Body=strwriter.ToString();
    msg.BodyFormat=MailFormat.Html;
    SmtpMail.SmtpServer="localhost";
    SmtpMail.Send(msg);
    msg.To=TextBox3.Text;
    msg.Subject="xyz";
    msg.Body=strwriter.ToString();
    msg.BodyFormat=MailFormat.Html;
    SmtpMail.SmtpServer="localhost";
    SmtpMail.Send(msg);
Working...
X