System.Web.Mail, OH MY! - A world apart from the everday ...

A world apart from the everday ...

Assert.IsTrue(Entries.Count == 0);

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.
 
whilst i was digging around i stumbled across http://www.systemwebmail.com/default.aspx ; what a gem of a site ... it has everything you could ever want to know about that joyful little namespace System.Web.Mail.
 
well happy emailing everybody!
Posted: Apr 06 2005, 03:00 PM by Ryan CrawCour | with 2 comment(s)
Filed under:

Comments

keithrull said:

have you set relay on your webserver?
# April 6, 2005 11:56 PM

Reyn said:

Check this for a drop in replacement:
http://dotnet.org.za/reyn/archive/2005/02/22/14733.aspx
# April 7, 2005 12:00 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: