c# 发送消息到Email

/// <summary>
        /// 发送消息到Email
        /// </summary>
        /// <param name="sendMsg">邮件中发送的内容</param>
        private void SendEmail(string sendMsg)
        {
            System.Net.Mail.SmtpClient client = new SmtpClient("smtp.qq.com");
            client.UseDefaultCredentials = false;
            client.Credentials = new System.Net.NetworkCredential("***@qq.com", "******");
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            MailAddress from = new MailAddress("***@qq.com", "PZ");
            MailAddress to = new MailAddress("z***@sina.com");
            System.Net.Mail.MailMessage message = new MailMessage(from, to);
            message.Body = sendMsg;
            message.Subject = "注册账号";
            message.BodyEncoding = System.Text.Encoding.Default;
            message.IsBodyHtml = true;
            client.Send(message);
        }

上一篇:CentOS 修改Mysql的root密码


下一篇:awk输出单引号,双引号