try like this
if( checkbox1.checked==true)
{
try
{
MailAddress fromAddress = new MailAddress(txtEmail.Text, txtName.Text);
smtpClient.Host = "localhost";
smtpClient.Port = 25;
message.From = fromAddress; message.To.Add("123@gmail.com");
message.Subject = "Hello";
message.IsBodyHtml = false;
message.Body = pswd;
smtpClient.Send(message);
Label1.Text = "Email successfully sent.";
}
}
or
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
}