public static void SendEmailClientHandler(ShowObject sender, EventArgs e) { Client client = null; int number = Convert.ToInt32(sender.objectBox.SelectedItem.ToString().Split(' ').Last().Remove(sender.objectBox.SelectedItem.ToString().Split(' ').Last().Length - 1)); client = DatabaseMethods.SelectClientFromQuery("SELECT * FROM Clients WHERE ClientNumber = '" + number.ToString() + "'"); Task.Run(() => EmailSender.SendIt(client, client.Email, client.RegisterDate, "Client information")); MessageBox.Show("E-mail sent to " + client.Email, "E-mail sent", MessageBoxButtons.OK, MessageBoxIcon.Information); sender.Dispose(); }