c#发送邮件

            System.Net.Mail.SmtpClient client = new SmtpClient("smtp.163.com");

            client.UseDefaultCredentials = false;
            client.Credentials = new System.Net.NetworkCredential("***@163.com", "*******");
            client.DeliveryMethod = SmtpDeliveryMethod.Network;

            string strmail = "***@qq.com";
            string strsbuject = "zhutizhuti";
            string strbody = "zhengwen";
            MailAddress addressFrom = new MailAddress("***@163.com", "张三");
            MailAddress addressTo = new MailAddress(strmail, "李四");

            System.Net.Mail.MailMessage message = new MailMessage(addressFrom, addressTo);
            message.Subject = strsbuject;
            message.Body = strbody;
            message.Sender = new MailAddress("***@163.com");
            message.BodyEncoding = System.Text.Encoding.UTF8;
            message.IsBodyHtml = true;

            client.Send(message); 

你可能感兴趣的:(c#发送邮件)