测试C#发送邮件

    static void Main(string[] args)
        {
            string mailAddress_from="[email protected]";

            System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("smtp.chinool.net", 25); 
            client.Credentials = new System.Net.NetworkCredential(mailAddress_from, "");
            try
            {
                client.Send(mailAddress_from, "[email protected]", "test2", "hello world");
                Console.WriteLine("邮件发送完毕");
            }
            catch (Exception e)
            {

                Console.WriteLine(e.Message);
                Console.WriteLine("失败!");
            }

          
            Console.Read();
        }

 

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