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
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
相关文章推荐
- 郁闷,这个问题从昨天到今天终于解决了
- SQL Develper 每次遇到这种情况我都郁闷,今天终于解决了。
- 今天心血来潮,重新弄安卓环境,发现只有4.4的版本,怎么装都不见其他版本,找了N多方法,加host文件,选择https/http也不行,最后找到了一篇终于搞定,底下加黄的就是亲测解决
- 解决SmtpClient在中文机器名下不能发邮件的方法
- 郁闷地问题终于解决了,唉,愚蠢地错误
- PHP的一个完整SMTP类(解决当mail()遇上邮件服务器需要验证时的问题) [转]
- 今天终于解决了一个头痛了两天的地图开发问题
- 使用 Indy 的 TIdSMTP, TIdPOP3收发邮件在验证账户的时候出现错误乱码解决方法
- The tow way of Debugging Scripting Code(郁闷了好久,终于找到了解决办法)
- 今天终于解决了ie与ff全兼容的问题
- 今天解决了郁闷的问题
- 在连接mysql5.1时正常,连接sql2000时就是连不上,郁闷,终于在网上找到了解答,原来是sql驱动和hibernate的兼容 性问题,现问题已解决,留此文备查.
- SOAP开发中遇到的郁闷问题终于解决了!
- 今天解决了一个很郁闷的问题!
- 很多天都没有解决的问题,今天终于搞定了!
- 历经漫长的跟踪、排查、对比、推动和验证, 终于在8个月后,解决了这个bug
- 今天终于解决tfs问题.
- phpmailer发邮件提示SMTP->ERROR: Failed to connect to server的解决方法
- 让人郁闷了好久的问题,终于解决了,之前网上也看到一些解决方法,但大多没有解决问题,所以记录下来,以供参考之用(ADO Could Not Find The Specified Provider)
- 使用telnet登陆smtp服务发邮件(带身份验证)