我如何在C#.net中发送电子邮件 [英] How I can send E-mail in C#.net
问题描述
你好
我有8个文本框
我想将文本框中的所有文本发送到我的电子邮件
我该怎么做?
还有另一个问题
我有progressBar1,我需要何时单击按钮mack prosseser
就像下载一样
我测试了
Hello
I have 8 Textbox
and i want send all text in textbox to my Email
How i can do that ?
and i have another question
i have progressBar1 , i need whene i click in button mack prosseser
just make like download
i tested
progressBar1.Value = 100;
但是我需要慢慢来
解冻您
But It''s very fast i need slowly
Thak you
推荐答案
要发送电子邮件,您可以尝试以下操作;
To send emails you can try something like this;
System.Web.Mail.MailMessage message=new System.Web.Mail.MailMessage();
message.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",1 );
message.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendusername","SmtpHostUserName" );
message.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendpassword","SmtpHostPassword" );
message.From="from e-mail";
message.To="to e-mail";
message.Subject="Message Subject";
message.Body="Message Body";
System.Web.Mail.SmtpMail.SmtpServer="SMTP Server Address";
System.Web.Mail.SmtpMail.Send(message);
您显然必须将用户名,密码和服务器名替换为适合您的名称.
至于进度条,您需要设置一个最小值和一个最大值,然后将.Value
属性设置为想要显示的任何进度.
上面的代码在此处 "http://social.msdn.microsoft.com/Forums/en/netfxnetcom/thread/a75533eb-131b-4ff3-a3b2-b6df87c25cc8" target ="_ blank" title ="New Window"> ^ ].
希望这会有所帮助,
Fredrik
You obviously have to replace the username, password and servername to something that will work for you.
As for the progress bar, you need to set a min and a max value, and after that you set the .Value
property to whatever progress you want shown.
Code above nicked from here[^].
Hope this helps,
Fredrik
U在邮件正文部分文本中添加您的所有文本"框文本....::laugh:
U add your All Text box Text in Mail Body Part Text..... :laugh:
这篇关于我如何在C#.net中发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!