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

    发送邮件

                SmtpClient client = new SmtpClient("smtp.qq.com");
                client.UseDefaultCredentials = true;
                client.Credentials = new System.Net.NetworkCredential("xxxxxxxxx", "xxxxxxxxx");
                client.DeliveryMethod = SmtpDeliveryMethod.Network;
    
                string file = @"D:发邮件代码 - 副本.txt";
                MailMessage message = new MailMessage(
                   "xxxxxxxxx@qq.com",
                   "xxxxxxxxx@qq.com",
                   "自动邮件",
                   "请勿回复!");
    
                // Create  the file attachment for this e-mail message.
                Attachment data = new Attachment(file, MediaTypeNames.Application.Octet);
                // Add time stamp information for the file.
                ContentDisposition disposition = data.ContentDisposition;
                disposition.CreationDate = System.IO.File.GetCreationTime(file);
                disposition.ModificationDate = System.IO.File.GetLastWriteTime(file);
                disposition.ReadDate = System.IO.File.GetLastAccessTime(file);
                 //Add the file attachment to this e-mail message.
                message.Attachments.Add(data);
                client.Send(message);
                data.Dispose();
  • 相关阅读:
    第七组(69)团队展示
    结对编程作业
    同步异步和阻塞非阻塞
    TCP和UDP和IP和HTTP和socket
    http协议
    数据库基础知识
    准确的笑话
    Java实现多线程的方式
    HashMap
    HTTPS与HTTP
  • 原文地址:https://www.cnblogs.com/baiqjh/p/3418717.html
Copyright © 2011-2022 走看看