テストC#メール送信

2346 ワード

    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();
        }