为啥邮件老是发送不成功呢?(代码贴出)
try
{
SmtpMail.SmtpServer="www.163.com";
SmtpMail.Send(this.Remail.Text,this.Tomail.Text,this.Title.Text,this.Contents.Text);
Response.Write("邮件发送成功");
}
catch(Exception ee)
{
Response.Write(ee.ToString());
}
错误信息如下:
System.Web.HttpException: 未能访问“CDO.Message”对象。 ---> System.Reflection.TargetInvocationException: 调用的目标发生了异常。 ---> System.Runtime.InteropServices.COMException (0x80040213): 与服务器的传输连接失败。 --- 内部异常堆栈跟踪的结尾 --- 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.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args) at System.Web.Mail.LateBoundAccessHelper.CallMethod(Type type, Object obj, String methodName, Object[] args) at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) --- 内部异常堆栈跟踪的结尾 --- 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 Test.Default.Button1_Click(Object sender, EventArgs e) in g:\test\default.aspx.cs:line 57
问题点数:0、回复次数:8Top
1 楼hjf1223(阿不)回复于 2005-06-04 14:26:46 得分 0
http://search.csdn.net/Expert/topic/1158/1158260.xml?temp=.2129328Top
2 楼hjf1223(阿不)回复于 2005-06-04 14:28:54 得分 0
http://search.csdn.net/Expert/topic/1737/1737709.xml?temp=.9067041Top
3 楼stoneyu(小赖-Love,love,love.)回复于 2005-06-04 15:05:04 得分 0
多看看程序...163的SMTP不是www.163.com吧..Top
4 楼jzywh(江大鱼)回复于 2005-06-10 12:53:28 得分 0
给邮件添加smtp验证信息
MyMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
MyMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername","用户名");
MyMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword","密码");
然后再SendTop
5 楼flyye_cs(一叶孤舟)回复于 2005-06-10 13:43:02 得分 0
http://bbs.hidotnet.com/6598/ShowPost.aspx (测试用例)Top
6 楼sunnystar365(一个人的天空)回复于 2005-06-10 14:22:32 得分 0
http://www.cnblogs.com/jzywh/archive/2005/06/09/170783.html
http://blog.joycode.com/ghj/archive/2004/10/22/36274.aspx
第一要配置SMTP服务,第一个网址里有
第二是关于杀毒软件的,因为有的杀毒软件会屏蔽掉25端口,第二个网址上有解释,
你可以把杀毒软件先关闭掉Top
7 楼vcforeverya()回复于 2005-06-10 14:24:02 得分 0
顶Top
8 楼lemong(風之影)回复于 2005-06-10 14:39:26 得分 0
1.SmtpMail.SmtpServer="smtp.163.com";----------smtp服务器地址就错了
2.给邮件添加smtp验证信息
MyMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
MyMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername","用户名");
MyMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword","密码");
然后再Send
Top




