This question is an exact duplicate of:

using System;

using System.Collections.Generic;

using System.Linq;

using System.IO;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using WebApplication5;

using System.Collections;

using System.Configuration;

using System.Data;

using System.Data.SqlClient;

using System.Net;

using System.Net.Mail;

namespace WebApplication5 {

public partial class SendMail : System.Web.UI.Page {

public SendMail()
    mailMessage mail = new MailMessage();


    mail.From = new MailAddress("");

    mail.Subject = "Email using Gmail";

    string Body = txtmessage.Text;

    mail.Body = Body;

    SmtpClient smtp = new SmtpClient();

    smtp.Host = ""; //Or Your SMTP Server Address

    smtp.Port = 587;

    smtp.UseDefaultCredentials = false;

    smtp.Credentials = new System.Net.NetworkCredential

    ("", "sagdgd!");

    //Or your Smtp Email ID and Password

    smtp.EnableSsl = true;


protected void Bttn_Send_Click(object sender, EventArgs e)

} }

Error 1 The name 'txtTo' does not exist in the current context
Error 2 The name 'txtmessage' does not exist in the current context

How to declear txtTo & txtmessage , could anyone help me please?

Related posts

Recent Viewed