• [传智播客学习日记]用C#代码发送电子邮件


     1 MailMessage mail = new MailMessage();
    2 mail.From = new MailAddress("发件人邮箱");
    3 mail.To.Add(new MailAddress("收件人邮箱"));
    4 mail.Subject = "标题字符串";
    5 mail.Body = "内容字符串";
    6 mail.Attachments.Add(new Attachment(@"附件地址"));
    7 SmtpClient sc = new SmtpClient("Smtp服务器地址或域名");
    8 sc.Credentials = new NetworkCredential("发件人邮箱", "发件人密码");
    9 sc.Send(mail);
    10 sc.Dispose();
    复制代码

    代码很容易看懂,主要是需要发件人的邮箱开启SMTP服务,今天中午用这段代码套在循环里写了个恶意邮件轰炸机,小有成就感,可是发现循环10000次对方只能收到20来封,有待继续研究...

    MailMessage mail = new MailMessage();
    mail.From = new MailAddress("发件人邮箱");
    mail.To.Add(new MailAddress("收件人邮箱"));
    mail.Subject = "标题字符串";
    mail.Body = "内容字符串";
    mail.Attachments.Add(new Attachment(@"附件地址"));
    SmtpClient sc = new SmtpClient("Smtp服务器地址或域名");
    sc.Credentials = new NetworkCredential("发件人邮箱", "发件人密码");
    sc.Send(mail);
    sc.Dispose();

  • 相关阅读:
    vss
    JavaScript中的5种事件使用方式解说
    loadrunner
    NET体系结构图
    eclipse Java Build Path
    httpModules 与 httpHandlers
    redhat linux5 安装配置 JDK1.6+Tomcat6+Apache2.2.x+jk_mod1.2
    如何在线使用MSDN
    petshop
    ADO.NET Entity Framework 使用数据定义语言(实体框架)
  • 原文地址:https://www.cnblogs.com/syg1/p/5870861.html
Copyright © 2020-2023  润新知