3
Reply

Sending until Progressbar processing...

Israel

Israel

Jun 1 2016 9:53 AM
349
Hi!
 
I wrote this code for sending my email. Its works!
But after to click to my button to send the content. Its make some seconds until sending completly. I need to insert a processBar into my StatusStrip (processing with a counter 1,2,3,4,5,etc) for example in wating the email to be sended totally. Its means when its end down at 100%. Its sended!
 
This my code:
 
try
{
SmtpClient client = new SmtpClient("smtp.live.com", 25); 
NetworkCredential cred = new NetworkCredential("emailFrom", "password");
MailMessage Msg = new MailMessage();
Msg.From = new MailAddress(txtEmailFrom.Text);
Msg.To.Add(txtEmailTo.Text);
Msg.Subject = txtEmailSubject.Text;
 
Msg.Body = txtEmailContent.Text;
client.Credentials = cred;
client.EnableSsl = true;
lblConfirmation.Text = "Mail Sended Succesfully";
client.Send(Msg);
}
catch{
lblConfirmation.Text = "Error";
}

Answers (3)