Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
No Overload takes 5 arguments
Message
De
19/09/2013 10:18:52
 
 
À
19/09/2013 09:23:50
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01583574
Message ID:
01583634
Vues:
30
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform