In this,post i will explain how to send email using c# with proccessing bar.
To do this,you have to follow few below given step.
step 1. first of all create a form as shown below:-
step 2. After making a form,drag a openfiledailog tool so that you can give path to file that you want to send to the email.
step 3. Double click the select button shown in image above and paste below given code.
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
textBox6.Text = openFileDialog1.FileName;
}
step 4. Now Double click the send email button and paste below given code.
progressBar1.Visible = true;
MailMessage Mail = new MailMessage();
progressBar1.Value = 10;
SmtpClient smtp = new SmtpClient("smtp.gmail.com");
progressBar1.Value = 20;
Mail.From = new MailAddress(textBox1.Text);
progressBar1.Value = 25;
Mail.To.Add(textBox3.Text);
progressBar1.Value = 30;
Mail.Subject = textBox4.Text;
progressBar1.Value = 35;
Mail.Body = textBox5.Text;
progressBar1.Value = 40;
System.Net.Mail.Attachment attachment = new System.Net.Mail.Attachment(textBox6.Text);
progressBar1.Value = 50;
Mail.Attachments.Add(attachment);
progressBar1.Value = 55;
smtp.Port = 587;
smtp.Credentials = new System.Net.NetworkCredential(textBox1.Text, textBox2.Text);
smtp.EnableSsl = true;
smtp.Send(Mail);
progressBar1.Value = 100;
MessageBox.Show("mail send");
progressBar1.Visible = false;
step 5. Now Run the program by ctrl+F5 or using menu bar(go to Debug<<start without debugging).
and fill the given fields and click send email button.
Thank for reading this..
Enjoy code
1 comments :
>>>>> Download Now
Reply>>>>> Download Full
>>>>> Download LINK
>>>>> Download Now
>>>>> Download Full
>>>>> Download LINK
Post a Comment