c# - Show Progress bar with smtpClient.send -


i using function send mails via gmail.

private bool uploadtogmail(string username, string password , string file ,      string backupnumber) {     mailmessage mail = new mailmessage();     smtpclient smtpserver = new smtpclient("smtp.gmail.com");     mail.from = new mailaddress("jain@gmail.com");     mail.to.add("jain@gmail.com");     mail.subject = "backup mail- dated- " + datetime.now + " part - " +          backupnumber;     mail.body = "hi self. mail contains \n backup number- " +          backupnumber + " \n dated- " + datetime.now ;      system.net.mail.attachment attachment;     attachment = new system.net.mail.attachment(file);     mail.attachments.add(attachment);      smtpserver.port = 587;     smtpserver.credentials =          new system.net.networkcredential("jain@gmail.com", "password");     smtpserver.enablessl = true;      smtpserver.timeout = 999999999;     smtpserver.send(mail);     //  messagebox.show("mail sent");     return true; } 

now want show progress bar (in case there large attachment) show upload . possible ? think know how use progress bar, don't know how use smtpclient.send() .

any ?

thanks

you should use sendasync , subscribe sendcompleted, know, when sending mail completed. there no way progress of send process, though...


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -