Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
No Overload takes 5 arguments
Message
From
19/09/2013 10:18:52
 
 
To
19/09/2013 09:23:50
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 4.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01583574
Message ID:
01583634
Views:
31
You'll need a try/catch in the calling routine, then throw the errors in SendEmails.

>Unfortunately this is legacy data that I'm working with so there was no validation when it was being entered. To catch the bad addresses, what I do is this:
>
>
                                try
>                                {
>                                    msg.To.Add(email.eml_email);
>                                }
>                                catch (Exception)
>                                {
>                                    badEmails += cus.cus_number + " - " + email.eml_email + ", ";
>                                }
>
>I agree, the design is not the best. It was written in a rush while trying to get a working solution to meet a deadline (and of course things getting added in to the specs during the development), hence why I am trying to refactor it now.
>
>The method is actually SendEmails (plural) so it is meant to send all the emails. So if I break it down to a method that does one thing, send an email. How do I trap an error if there is an error sending it and report it back to the calling method?
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Reply
Map
View

Click here to load this message in the networking platform