MailMessage mm=new MailMessage(); mm.From="[email protected]";
mm.To="[email protected]";
mm.Subject="收到了回个话";
mm.Body="为什么Smtp类的Server属性不提供口令验证";
mm.Attachments.Add(new MailAttachment("c:\\test.txt"));
//Attachments实现IList接口,可以添加多个附件 SmtpMail.SmtpServer="webmail.careland.com.cn";
//设置发送邮件的Smtp服务器,目前没有提供需要身份验证的服务器的登陆方法
//比如163.net,163.com都不行,目前我的是我公司的SMTP服务器
//看看大伙有没有更好的办法
SmtpMail.Send(mm);
MessageBox.Show("OK");
mm.To="[email protected]";
mm.Subject="收到了回个话";
mm.Body="为什么Smtp类的Server属性不提供口令验证";
mm.Attachments.Add(new MailAttachment("c:\\test.txt"));
//Attachments实现IList接口,可以添加多个附件 SmtpMail.SmtpServer="webmail.careland.com.cn";
//设置发送邮件的Smtp服务器,目前没有提供需要身份验证的服务器的登陆方法
//比如163.net,163.com都不行,目前我的是我公司的SMTP服务器
//看看大伙有没有更好的办法
SmtpMail.Send(mm);
MessageBox.Show("OK");
Message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", txtUserName.Text ); //set your username here
Message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", txtPassword.Text ); //set your password here
Message.To = txtTo.Text;
Message.Cc = txtCC.Text;
Message.Bcc = txtBCC.Text;
Message.From = txtFrom.Text;
Message.Subject = txtSubject.Text;
Message.BodyFormat = (MailFormat)System.Enum.Parse(typeof(MailFormat), ddlMailFormat.SelectedValue );
Message.Body = txtMessage.Text; SmtpMail.SmtpServer = txtServer.Text;
SmtpMail.Send(Message);
Message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", txtUserName.Text ); //set your username here
Message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", txtPassword.Text ); //set your password here这个用户名和密码,我是不是要去这个网站注册?用户名和密码,如何获得?