zoukankan      html  css  js  c++  java
  • asp.net实现邮件的发送

     asp.net实现邮件的发送

     1try
     2        {
     3            CDO.Message Msg = new CDO.Message();
     4            Msg.From = "YY@sohu.com";
     5            Msg.To = "XX@sohu.com";
     6            Msg.Subject = "主题";
     7            Msg.HTMLBody = "<html><body>" + "内容"
     8        + "</body></html>";
     9            CDO.IConfiguration Config = Msg.Configuration;
    10            ADODB.Fields oFields = Config.Fields;
    11            oFields["http://schemas.microsoft.com/cdo/configuration/sendusing"].Value = 2;
    12            oFields["http://schemas.microsoft.com/cdo/configuration/sendemailaddress"].Value = "YY@sohu.com";
    13            oFields["http://schemas.microsoft.com/cdo/configuration/smtpaccountname"].Value = "YY@sohu.com";
    14            oFields["http://schemas.microsoft.com/cdo/configuration/sendusername"].Value = "YY";
    15            oFields["http://schemas.microsoft.com/cdo/configuration/sendpassword"].Value = "password";
    16            oFields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"].Value = 1;
    17            oFields["http://schemas.microsoft.com/cdo/configuration/languagecode"].Value = 0x0804;
    18            oFields["http://schemas.microsoft.com/cdo/configuration/smtpserver"].Value = "smtp.sohu.com";
    19            oFields.Update();
    20            Msg.BodyPart.Charset = "gb2312";
    21            Msg.HTMLBodyPart.Charset = "gb2312";
    22            Msg.Send();
    23            Msg = null;
    24        }

    25        catch (Exception err)
    26        {
    27            throw err;
    28        }
    [ftc=#EE1D24]<font color=red></font>[/ft]  
  • 相关阅读:
    交换机工作原理
    MyBatis框架的使用及源码分析(一) 配置与使用
    MySQL5.6安装步骤
    mysql创建用户,并授权
    命令行访问远程mysql数据库
    [mybatis] mybatis错误:Invalid bound statement (not found)
    【大数据】每秒十万笔交易的数据架构解读
    【mybaits】Mybatis中模糊查询的各种写法
    【redis】 linux 下redis 集群环境搭建
    [linux] linux下编译安装zlib
  • 原文地址:https://www.cnblogs.com/huangwen/p/644646.html
Copyright © 2011-2022 走看看