Click here to Skip to main content
15,905,867 members
Please Sign up or sign in to vote.
3.67/5 (2 votes)
See more:
how to send email on selecting the check box
Posted

use the postback of the checkbox checkedchanged event. Then send an email using the normal smtp client from system.net.mail!

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.checkbox.checkedchanged.aspx[^]
 
Share this answer
 
Put check box AutoPostBack=true
C#
<asp:checkbox id="checkbox1" runat="server" xmlns:asp="#unknown">
                    AutoPostBack="True" /></asp:checkbox>


Then inside code block write
C#
if(checkbox1.Checked==true)
{
  //call method for sending mail
}


Send mail link
Send Email in ASP.Net 2.0 - Feed back Form[^]
 
Share this answer
 
try like this
C#
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");//here you have to pass checkbox text or toaddress
           message.Subject = "Hello";





           message.IsBodyHtml = false;


           message.Body =  pswd;


           smtpClient.Send(message);

           Label1.Text = "Email successfully sent.";
       } 
}

or
C#
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
    {
//write mail code here
    }
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900