C# 邮件类 Mailmessage

            MailMessage Mailmsg = new MailMessage();
            Mailmsg.To = "wu922008@126.com";
            Mailmsg.From = "wu922008@163.com";
            Mailmsg.Subject = "测试";
            Mailmsg.Body = "我  love you";
            Mailmsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
            //设置验证用户名(邮箱的用户名)  
            Mailmsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "wu922008@163.com");
            //设置验证密码(邮箱的密码)  
            Mailmsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "**********");  
            SmtpMail.SmtpServer = "smtp.163.com";
            SmtpMail.Send(Mailmsg);
            Console.WriteLine("邮件发送完成!!");
posted @ 2012-04-14 16:04  至道中和  阅读(762)  评论(0编辑  收藏  举报