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

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net.Mail;//发送邮箱
    using System.Text;
    using System.Threading.Tasks;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                MailMessage mm = new MailMessage();//
                mm.Priority = MailPriority.High;
                mm.To.Add("1024477951@qq.com");//收信邮箱
                //mm.CC.Add();//抄送
                mm.From = new MailAddress("1024477951@163.com");//发信邮箱
                //mm.Attachments.Add(new Attachment(文件名))//文件附件
                mm.Subject = "测试";
                mm.BodyEncoding = Encoding.UTF8;
                mm.Body = " <a href='http://localhost:3255/ReceiveMail.aspx?id=11'>请假</a>";//定义信的内容
                mm.IsBodyHtml = true;//设置内容为html格式
    
    
                // Smtp:简单邮件传输协议,发邮件   POP3 收邮件
                SmtpClient sc = new SmtpClient();
                sc.DeliveryMethod = SmtpDeliveryMethod.Network;//设置邮件通过网络发送
                sc.Host = "smtp.163.com";//设置邮件服务地址
                sc.Credentials = new System.Net.NetworkCredential("1024477951", "123");//验证发件人身份,"123abc"是发件人密码s
                sc.Send(mm);
                Console.WriteLine("发送成功!");
            }
        }
    }
    View Code
  • 相关阅读:
    240. Search a 2D Matrix II
    442. Find All Duplicates in an Array
    4. Median of Two Sorted Arrays
    3. Longest Substring Without Repeating Characters
    poj 3616
    cf 337 div2 c
    poj 2385
    poj 2229
    uvalive 3231
    Entity Framework 学习初级篇7--基本操作:增加、更新、删除、事务
  • 原文地址:https://www.cnblogs.com/LiuZhen/p/3589816.html
Copyright © 2011-2022 走看看