Click here to Skip to main content
15,917,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to create confirmation box in asp.net using c# without using extender
Posted
Updated 28-Apr-19 19:54pm
v4
Comments
ankitsrist 9-Apr-13 8:18am    
write within your button tag onClientClick="javascript:confirm("are you sure to delete")";

private void button1_Click(object sender, EventArgs e)
{

try
{
string[] EmailsTolist = textBoxTo.Text.Split(',');
foreach (DataGridViewRow row in dataGridView1.Rows)
{
try
{
string filename2 = row.Cells[3].Value.ToString();

MailMessage mail = new MailMessage("farizkhan301@gmail.com", row.Cells[2].Value.ToString(), textBoxSubject.Text, textBoxMessage.Text);
// mail.Attachments.Add(new Attachment("filenameFromOpen Dialogbox"));
mail.Attachments.Add(new Attachment(filename2));
SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
smtp.EnableSsl = true;
smtp.Timeout = 1000000;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential("farizkhan301@gmail.com","rizwan//98765");
smtp.Send(mail);
}
catch (Exception ex)
{
}
}
/*SmtpClient Client = new SmtpClient("smtp.gmail.com", 587);
Client.EnableSsl = true;
Client.Timeout = 1000000;
Client.DeliveryMethod = SmtpDeliveryMethod.Network;
Client.UseDefaultCredentials = false;
Client.Credentials = new NetworkCredential("farizkhan301@gmail.com","rizwan//98765);
MailMessage msge = new MailMessage();
msge.To.Add("farizkhan301@gmail.com");
msge.From = new MailAddress("");
msge.Subject = textBoxSubject.Text;
msge.Body = textBoxMessage.Text;
Client.Send(msge);*/
MessageBox.Show("Emails Have Been Sent Successfully");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
 
Share this answer
 

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