private static void SendMail(Cat cat) { try { var loginInfo = new NetworkCredential("*****@*****.**", "V746025625VLADIMIRNO"); var msg = new MailMessage { From = new MailAddress("*****@*****.**") }; msg.To.Add(new MailAddress("*****@*****.**")); msg.Subject = "Cats!!"; msg.Body = "<p>Cat deleted:</p><p><b>breed:</b></p><p>" + cat.GetBreed() + "</p>country" + cat.GetCountry() + "</p><p><b>origin:</b> " + cat.GetOrigin() + "</p><p><b>body type:</b> " + cat.GetBodyType() + "</p><p><b>coat:</b> " + cat.GetCoat() + "</p><p><b>pattern:</b> " + cat.GetPattern() + "</p><p><b>image:</b> " + cat.GetImage() + "</p><p><b>information:</b> " + cat.GetInfo() + "</p>"; msg.IsBodyHtml = true; var client = new SmtpClient("smtp.gmail.com") { EnableSsl = true, UseDefaultCredentials = false, Credentials = loginInfo }; client.Send(msg); } catch (Exception ex) { var msg = "Failed to send message: "; msg += ex.Message; throw new Exception(msg); } }