您现在的位置是:首页 >

手机邮件怎么发送邮件 使用ASP.NET两种发送邮件的方法

火烧 2022-09-26 02:48:10 1030
使用ASP.NET两种发送邮件的方法   如果你的ASP NET程序学得不错了 想用ASP NET来发送邮件 在网上有好多文章 本站不管网上说是如何实现的 下面整理两种 NET发送邮件的方法给你参考一

使用ASP.NET两种发送邮件的方法  

  如果你的ASP NET程序学得不错了 想用ASP NET来发送邮件 在网上有好多文章 本站不管网上说是如何实现的 下面整理两种 NET发送邮件的方法给你参考一下 很简单的哦

  第一种

   配置文件(nfig) + 少量C#代码

  在 configuration 节点下添加

  <>    <mailSettings>      <smtp from= >        <neork host= password= baidu port= userName= baidu defaultCredentials= false />      </smtp>    </mailSettings>  </>

  /// <summary>

  /// 发送邮件/// </summary>private void SendMail(){    System Net Mail MailMessage message = new System Net Mail MailMessage();    message From = new System Net Mail MailAddress( );//发送人邮箱地址 与smtp节点中的from值一致    message To Add(new System Net Mail MailAddress( ));//接收人邮箱地址    message Subject = hello ;    message Body = <b>taobao</b> ;    message IsBodyHtml = true;    System Net Mail SmtpClient smtpclient = new System Net Mail SmtpClient();    smtpclient Send(message);}

  好 介绍完第一种发送邮件的方法 下面看第二种

  /// <summary>

  /// 发送邮件/// </summary>private void SendMail(){    System Net Mail MailMessage message = new System Net Mail MailMessage();    message From = new System Net Mail MailAddress( );//发送人邮箱地址 与smtp节点中的from值一致    message To Add(new System Net Mail MailAddress( ));//接收人邮箱地址    message Subject = hello ;    message Body = <b>taobao</b> ;    message IsBodyHtml = true;    System Net Mail SmtpClient smtpclient = new System Net Mail SmtpClient( );    smtpclient Credentials = new System Net NeorkCredential( baidu baidu );//参数分别是邮箱用户名和密码    smtpclient Send(message);}

手机邮件怎么发送邮件 使用ASP.NET两种发送邮件的方法
lishixinzhi/Article/program/net/201311/11581  
永远跟党走
  • 如果你觉得本站很棒,可以通过扫码支付打赏哦!

    • 微信收款码
    • 支付宝收款码