.net自带的发送email方法

MailMessage mail = new MailMessage();
            mail.From 
= "\"***错误信息\" <***@163.com>";//设定发件人名字和地址(必须填写)
            mail.BodyFormat = MailFormat.Html;//用html格式
            mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate""1"); //basic authentication
            mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername","***"); //设定SMTP验证的用户名
            mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword""***"); //设定SMTP验证的密码        
            SmtpMail.SmtpServer = "smtp.163.com";//设定SMTP服务器地址
            mail.To = "***@126.com" ;//设定收件人地址(必须填写)。
            mail.Subject = "***错误信息";
            mail.Body 
= "这里是发送的内容";
            SmtpMail.Send(mail);

posted on 2005-05-16 00:34  黎宇  阅读(341)  评论(0)    收藏  举报

导航