System.Web.Mail, OH MY!
so who has tried to send an email using .NET yet?
easy you say ... well in theory it should be ... that is until you get the wonderful “Could not access 'CDO.Message' Object” error!
i mean how useful is this message?
the CDO objects are there ao why can't they be accessed!?!
in fact dig a little deeper my dearest plebbs and discover another intricate little “un-documented feature” ... the real exception is hidden about 5 levels deep!
"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 (0x8004020F): The server rejected one or more recipient addresses. The server response was: 553 malformed address: \r\n\r\n --- End of inner exception stack trace ---\r\n at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)\r\n at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters)\r\n at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args)\r\n at System.Web.Mail.LateBoundAccessHelper.CallMethod(Type type, Object obj, String methodName, Object[] args)\r\n at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)\r\n --- End of inner exception stack trace ---\r\n at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)\r\n at System.Web.Mail.CdoSysHelper.Send(MailMessage message)\r\n at System.Web.Mail.SmtpMail.Send(MailMessage message)\r\n at itware.sab.shop.eventmonitoring.mailer.Mailer.SendIt(String from, String to, String cc, String bcc, String subject, String body) in d:\\development\\projects\\sab\\itware.sab.shop.eventlogservice\\service\\mailer.cs:line 41\r\n at itware.sab.shop.eventmonitoring.mailer.Mailer.SendIt(String from, String to, String subject, String body) in d:\\development\\projects\\sab\\itware.sab.shop.eventlogservice\\service\\mailer.cs:line 20\r\n at itware.sab.shop.eventmonitoring.service.EventsMonitor.DoUnsent() in d:\\development\\projects\\sab\\itware.sab.shop.eventlogservice\\service\\eventsmonitor.cs:line 220"
*sigh*
why is it that people insist on using the .InnerException property?
Isn't it accepted best practise not to use InnerExceptions unless you ABSOLUTELY have to?
what do others think about “hiding exceptions” inside nested InnerExceptions?
me; i'd prefer them out there in the open and in my face ... at least that way i know right off where i screwed up.
this simple little problem cost me hours of reading and investigating when i could've solved the problem in minutes if i'd known the REAL error upfront.
well happy emailing everybody!