进度条与发送邮件 [英] Progress Bar With Send Mail

查看:158
本文介绍了进度条与发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Friends;

i想要在我使用此代码发送邮件时显示进度条





 MailMessage mail =  new  MailMessage( from ,to,subject,body) ; 
SmtpClient client = new SmtpClient(smtp);
client.Port = 587 ;
client.Credentials = new System.Net.NetworkCredential( from ,pass);
client.EnableSsl = true ;
client.Send(mail);
MessageBox.Show( 完成 Succ,MessageBoxButton.OK);







请帮助

谢谢;

解决方案

或使用 SendAsync 方法而不是发送方法 SmtpClient



以便控制立即返回。



显示ProgressBar,

Style = Marquee



处理 SendCompleted 事件。



并在邮件发送完成时隐藏此事件中的ProgressBar控件(或其他)。



这不会显示当前邮件的进度,但至少要比等待它完成更好。



-praveen。

Hello Friends ;
i want to show progress bar while i sent mail using this code


MailMessage mail=new MailMessage(from,to,subject,body);
                    SmtpClient client=new SmtpClient(smtp);
                    client.Port = 587;
                    client.Credentials = new System.Net.NetworkCredential(from, pass);
                    client.EnableSsl = true;
                    client.Send(mail);
                    MessageBox.Show("Done","Succ",MessageBoxButton.OK);




please help
Thanks;

解决方案

or Just Send Mail Asynchronous using SendAsync method instead of Send method of SmtpClient

so that control returns immediately.

Display a ProgressBar,
with Style=Marquee,

Handle the SendCompleted event.

and Hide the ProgressBar control (or whatever) in this event, when mail sending is complete.

this will not show the progress of current mail, but at least better than just waiting for its completion.

-praveen.


这篇关于进度条与发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆