zoukankan      html  css  js  c++  java
  • .net发送邮件

    发送邮件,很简单的东西,主要用的就是System.Net.Mail命名空间下的东西

     1  System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
     2             message.To.Add("targetAddress");
     3             message.Subject = "This is the Subject line";
     4             message.From = new System.Net.Mail.MailAddress("sourceAddress");
     5             message.Body = "content";
     6             //附件
     7             string path=@"C:\Documents and Settings\administrator\桌面\SN.txt";
     8             Attachment data = new Attachment(path, MediaTypeNames.Application.Octet);//实例化附件
     9             message.Attachments.Add(data);
    10 
    11             System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.163.com", 25);
    12             smtp.Credentials = new System.Net.NetworkCredential("testID", "testPWD");
    13             smtp.Send(message);

    很久没写过随笔了,今天也是需要记录一个东西,才上来写一笔的,主要是最近工作比较忙,上班没时间写,下班懒得写,于是。。就这样了,以后还是要勤快一些,尽量多写一些

  • 相关阅读:
    phpcms相关
    php文件缓存
    js 、jq强化复习
    框架替换主页
    羽恒梦工厂所有后台的操作页面
    羽恒梦工厂个人中心
    羽恒梦工厂详情页
    待查的问题
    ASP.NET中的常用快捷键
    快速排序
  • 原文地址:https://www.cnblogs.com/goldren/p/3125577.html
Copyright © 2011-2022 走看看