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

    //from是发送的邮箱地址
    //to是指发送的目标邮箱
    ///subject是标题
    ///body是发送的内容,注意相关词汇可能会导致当垃圾邮箱处理
    private void SendMessage(string from, string to, string subject, string body)
    { System.Net.Mail.MailMessage mm = null; SmtpClient Client; Client = new SmtpClient { Host = "smtp.163.com",//QQ的是smtp.qq.com Port = 25,//端口测试和QQ的都是25测试成功 DeliveryMethod = SmtpDeliveryMethod.Network }; Client.UseDefaultCredentials = false; Client.Credentials = new NetworkCredential("***@163.com", "smtp服务的密码");//在设置里面开启会有密码提示QQ同理

    try
    {
    mm = new System.Net.Mail.MailMessage(from, to, subject, body);
    mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
    mm.BodyEncoding = System.Text.Encoding.UTF8;
    mm.IsBodyHtml = true;
    Client.Send(mm);
    isSent = true;

    } catch (Exception ex)
    {

    //process ex.message

    } finally {
    mm.Dispose();

    }


    }
  • 相关阅读:
    数据链路层
    补码加减法
    matlab函数
    HDU2159_二维完全背包问题
    HDU2844买表——多重背包初探
    HDU1025贫富平衡
    最大m段子段和
    01背包浮点数情况
    第K大01背包
    HDU2955 01背包
  • 原文地址:https://www.cnblogs.com/professional-NET/p/5043822.html
Copyright © 2011-2022 走看看