您的位置:首页 > 编程语言 > PHP开发

smtp验证发邮件,今天好郁闷,终于解决了

2004-05-10 17:12 323 查看
需要添加引用“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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐