Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sending Email Asynchronously
Message
De
18/01/2013 09:40:05
 
 
À
18/01/2013 08:21:52
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01563134
Message ID:
01563255
Vues:
48
Think my last post was correct. Maybe remove the using when creating the SmtpClient and put 'client.Dispose()' in the delegate callback. i.e in outline:
SmtpClient client = new SmtpClient();
                    {
                        client.SendCompleted += new SendCompletedEventHandler(SendCompletedCallback);
                            try
                            {
                                 client.SendCompleted += delegate
                                {
                                  client.Dispose();
                                    lock (numRemainingLock)
                                    {
                                        if (--numRemaining == 0)
                                        {
                                            waitHandle.Set();
                                        }
                                    }
                                };
                                client.SendAsync(msg, userState);                 // Send our email.   
                            }
                            catch (Exception)
                            {
                                msg.Dispose();
                                // throw;
                            }
                        }
                    }
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform