See this:
http://www.microsoft.com/China/Community/program/originalarticles/TechDoc/sendmail.mspx
http://www.microsoft.com/China/Community/program/originalarticles/TechDoc/sendmail.mspx
解决方案 »
- asp.net
- 如何将table里面的所有内容导入到excel里面,保留内容,页面格式,除去控件!!
- 前两天还可以访问,现在访问我的网页成了这样!问一下什么原因,编码的问题?
- 大數據量處理 & dataAdapter.Fill超时
- |M| 如何获得客户端所在的城市和客户端的上网方式 ---------------谢谢
- 控件调用问题
- asp.net中在<HyperLink>中加入?id=<%# DataBinder.Eval(Container.DataItem,"id")%>会出错?
- 如果一个用户登陆了,怎么判断使在另一个客户机不能用同一个用户名登陆?
- 导出excel的乱码问题,
- 高手请进,插入数据时遇到的问题!
- 保护绿地——软件基地开通,可以周转50M的文件!
- 如何从框架的一个页面中获得另外一个页面的地址信息
Message.From=sender_ddl.SelectedItem.Value+"@tpco.com.cn";
Message.To=TextBox1.Text;
Message.Subject=TextBox3.Text;
Message.Body=TextBox2.Text;
Message.BodyFormat=MailFormat.Text;
Message.Priority=MailPriority.Low;
string[] ServerPool = new string[2];
ServerPool[0]="dns.tpco.com.cn";
//ServerPool[1]="smtp.163.com";
SmtpMail.SmtpServer=ServerPool[0];
try
{
SmtpMail.Send(Message); catch
{
Response.Write("<script language='javascript'>alert('邮件发送失败!')</script>");
}
发送邮件失败:System.Web.HttpException: Could not access 'CDO.Message' object. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80040213): The transport failed to connect to the server. --- End of inner exception stack trace --- at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) --- End of inner exception stack trace --- at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) at System.Web.Mail.CdoSysHelper.Send(MailMessage message) at System.Web.Mail.CdoSysHelper.Send(String from, String to, String subject, String messageText) at System.Web.Mail.SmtpMail.Send(String from, String to, String subject, String messageText) at ASP.mail_aspx.send_Mail(Object sender, EventArgs e) in D:\yuyongfa\chaoyang\mail.aspx:line 23
SmtpMail.SmtpServer = "代理服务器的IP地址";
如果没有用就用SmtpMail.SmtpServer = "本地机服务器的IP地址";