`
huozheleisi
  • 浏览: 1237962 次
文章分类
社区版块
存档分类
最新评论

using System.Web.Mail to send email

 
阅读更多

there are many demos for send a email with c sharp language .however,you will find that most of them will be failed because of SMTPServer.Especially,authorization is required.

publicvoidSendEMail()
...{
MailMessagemail
=newMailMessage();
mail.Priority
=MailPriority.High;
mail.From
="cccc@gmail.com";
mail.To
="cccc@163.com";
mail.Subject
="SendEMailSystemDemo";
mail.Body
="Justfortest.";
mail.BodyEncoding
=Encoding.UTF8;

//authorization
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing",1);
mail.Fields.Add(
"http://schemas.microsoft.com/cdo/configuration/sendemailaddress",mail.From);
mail.Fields.Add(
"http://schemas.microsoft.com/cdo/configuration/smtpuserreplyemailaddress",mail.From);
mail.Fields.Add(
"http://schemas.microsoft.com/cdo/configuration/smtpaccountname","cccc@163.com");
mail.Fields.Add(
"http://schemas.microsoft.com/cdo/configuration/sendpassword","cccc");
mail.Fields.Add(
"http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",1);
mail.Fields.Add(
"http://schemas.microsoft.com/cdo/configuration/smtpserver","smtp.163.com");

SmtpMail.SmtpServer
="smtp.163.com";
SmtpMail.Send(mail);
}

#endregion

分享到:
评论

相关推荐

    VB编程资源大全(英文源码 网络)

    email.zip Sending Email using MAPI control.<END><br>51 , EmailChecker.zip Checks your new mails from mutiple mail servers(yeah it works!!!!!). it switches tray icons on different states & ...

    计算机网络第六版答案

    14. If the two ISPs do not peer with each other, then when they send traffic to each other they have to send the traffic through a provider ISP (intermediary), to which they have to pay for carrying ...

    ZendFramework中文文档

    14.5.4. Using Metacommands to Control Filter or Validator Rules 14.5.4.1. The FIELDS metacommand 14.5.4.2. The PRESENCE metacommand 14.5.4.3. The DEFAULT_VALUE metacommand 14.5.4.4. The ALLOW_...

    VB编程资源大全(英文源码 ASP)

    <END><br>12,ASP_CDOMail.zip Using Microsoft Technologies, a simple example of how to send email using ASP, CDO, and IIS. Full Source. Information on CDO is well documented on the Internet. <END>...

    ICS delphixe10源码版

    For more generous amount, contact me by email. Register -------- ICS is freeware. If you use the components, you must register by sending a picture postcard showing the area you live in and some ...

    a project model for the FreeBSD Project.7z

    The vision is “To produce the best UNIX-like operating system package possible, with due respect to the original software tools ideology as well as usability, performance and stability.” The ...

    Clever Internet Suite (SRC) v9.1.0.0

    The Clever Internet Suite components allow you to compose and parse messages in MIME format with multiple file attachments, build and send Web Form POST requests and many other features. The SMTP, ...

    CakePHP 1.3 Application Development Cookbook.pdf

    The second recipe shows how to send an e-mail using the Email component. The third recipe shows how to use the MagicDb class to detect the type of a file, and the last recipe shows how to create ...

    xyplorer_full.zip

    Only as a last resort, send us a bug report by email: E-mail: support@xyplorer.com Feel free to contact us to get support, report bugs or give suggestions. Again, primarily via the user forum, ...

    php.ini-development

    You may be able to send headers and cookies after you've already sent output ; through print or echo. You also may see performance benefits if your server is ; emitting less packets due to buffered ...

    OutlookAttachView v2.73

    o Added %from_email% and %to_email% variables to the attachment filename format. * Version 2.71 o Added %localmsgtime% and %localmsgdate% variables to the attachment filename format. o Fixed a ...

    VB编程资源大全(英文源码 其它)

    prngmit.zip This Random Number Generator is for everybody who is tired of using the "Randomize" and "Rnd" in VB and VBScript and having to watch the SAME "Random" numbers appear (The problem is ...

    BSD HACKS -- 100个业界最尖端的技巧和工具

    Send and Receive Email Without a Mail Client Section 49. Why Do I Need sendmail? Section 50. Hold Email for Later Delivery Section 51. Get the Most Out of FTP Section 52. Distributed ...

    TMS Pack for FireMonkey2.3.0.1

    Fixed : Issue with readonly cells when using columns in TTMSFMXGrid Fixed : Issue accessing correct cell colors in TTMSFMXGrid Fixed : Issue with displaying DetailView in TTMSFMXTableView v2.1.0.3...

    高清监控系统兼容所有网络摄像机

    Send Alarm To Client=发送报警到客户端 Send Alarm E-Mail=发送报警到邮件 Refresh Photo=刷新图像 Save Settings=保存设置 ;报警设置页面 Alarm duration:=报警持续时间: E-Mail Setup=邮件设置 Sender:=发件人: ...

Global site tag (gtag.js) - Google Analytics