using System; using System.ComponentModel; using System.Net; using System.Text; using System.Net.Mail; namespace ConsoleApplication1 { class Program { static bool mailSent = false; public static void SendCompletedCallback(object sender, AsyncCompletedEventArgs e) { // Get the unique identifier for this asynchronous operation. String token = (string)e.UserState; if (e.Cancelled) { Console.WriteLine("[{0}] Send canceled.", token); } if (e.Error != null) { Console.WriteLine("[{0}] {1}", token, e.Error.ToString()); } else { Console.WriteLine("Message sent."); } mailSent = true; } public static void Main(string[] args) {