使用System.Web.Mail发送邮件时出错

时间:2020-03-06 14:53:25  来源:igfitidea点击:

使用System.Web.Mail的较旧的应用程序将对来自[email protected]的电子邮件引发异常。其他地址似乎工作正常。当错误开始时,我们将邮件服务器更改为Exchange 2007,因此我认为这是问题所在。有人知道发生了什么吗?

这是异常和堆栈跟踪:

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 (0x80040212): The transport lost its connection 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.SmtpMail.Send(MailMessage message)

     at ProcessEmail.Main()

解决方案

客户端的主机是否具有通过Exchange服务器发送邮件的权限?

这是诊断这些异常的教程(一种非常常见的具有很多含义的异常)。