I have written the following code for sending Email. I have used my Gmail username and password for Network credentials.

string strEmailID ; //It is some valid Email ID.

MailMessage mail = new MailMessage("[email protected]", strEmailID);
mail.Subject = "New Reimbursement added";
mail.Body = "Test";

SmtpClient client = new SmtpClient();
client.Port = 587;
client.Host = "smtp.gmail.com";
client.EnableSsl = true;
client.Credentials = new NetworkCredential(username, password);
client.Send(mail);

But this doesn't work for all systems. In some systems, it is successfully sending mail, but in some systems, it is throwing an exception.

Can any one help me regarding this.