try below snippet, here I am sending mail using Gmail account
put your code always I TRY..CATCH block to get exact error
MailMessage mail = new MailMessage();
mail.From = new MailAddress("MailFrom@gmail.com");
mail.To.Add(new MailAddress("MailTo@gmail.com"));
Attachment att = new Attachment("D:\\test.txt");
mail.Attachments.Add(att);
mail.Subject = "Send Email with Gmail using ASP.NET";
string Body = "Put your Email Body TEXT here";
mail.Body = Body;
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Credentials = new System.Net.NetworkCredential("abc@gmail.com", "PASSWORD");
smtp.EnableSsl = false;
smtp.Send(mail);
Exception points
There are so many factor that may affects your email sending code, here is list,
1. Firewall block port 587 (This is port for smtp gmail server)
2. Internet connection is not available on machine or internet connection has face some obstacles while pinging
3. Due to some typo mistake UserName and password may be get wrong
4. Enable SSL is block email sending
5. POP settings for smtp server in your Gmail account is disabled