测试C#发送邮件

    static void Main(string[] args)
        {
            string mailAddress_from="yftan@chinchool.net";

            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, "14816898@qq.com", "test2", "hello world");
                Console.WriteLine("邮件发送完毕");
            }
            catch (Exception e)
            {

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

          
            Console.Read();
        }

 

posted @ 2013-02-22 17:27  二师弟tl  阅读(238)  评论(0编辑  收藏  举报