.net 发邮件

public static void SendEmail(string subject, string content, string emailAddress)
        {

            SmtpClient Client = new SmtpClient("smtp.163.com");
            Client.UseDefaultCredentials = false;
            Client.DeliveryMethod = SmtpDeliveryMethod.Network;

            Client.Credentials = new System.Net.NetworkCredential("[email protected]", "aaaaaaa");


            MailMessage Message = new MailMessage("[email protected]", emailAddress, subject, content);


            Message.IsBodyHtml = true;
            Message.BodyEncoding = System.Text.Encoding.UTF8;

            Client.Send(Message);
            Message.Dispose();

        }

你可能感兴趣的:(.net)