smtp验证发邮件
需要添加引用“Microsoft CDO for Windows 2000 Library“
using CDO;
using System.Web.Mail;
MailMessage mail = new MailMessage();
mail.To = " to@mail.com";
mail.From = "from@mail.com";
mail.Subject = "this is a test email.";
mail.Body = "Some text goes here";
mail.Fields.Add(CdoConfiguration.cdoSMTPAuthenticate, "1");
mail.Fields.Add(CdoConfiguration.cdoSendUserName, "username"); //用户名
mail.Fields.Add(CdoConfiguration.cdoSendPassword, "pass"); //密码
SmtpMail.SmtpServer = "smtp.263.net"; //smtp邮件服务器
try
{
SmtpMail.Send(mail);
}
catch(System.Runtime.InteropServices.COMException e1)
{
Response.Write(e1.ToString());
}
参考
http://www.csdn.net/Develop/Read_Article.asp?Id=14850
http://blog.joycode.com/joy/posts/11405.aspx
posted on 2004-06-29 08:09 HelloSnoopy 阅读(567) 评论(0) 编辑 收藏 举报