I am trying to send email using ASP.NET through Gmail server. This is my code, can you help me how to resolve the timeout issue.
        try
        {
            MailMessage mail = new MailMessage();
            SmtpClient smtp = new SmtpClient("smtp.gmail.com"); 
            mail.IsBodyHtml = true;
            mail.Priority = System.Net.Mail.MailPriority.High;
            mail.From = new MailAddress("FromEmail@gmail.com");
            mail.To.Add("ToEmail@gmail.com");
            mail.Subject = "Fees Reminder";                
            mail.Body = "Please, Student ID: " + username + " pay your fees " + sqlFeesValue + ".";
            mail.Body += " <html>";
            mail.Body += "<body>";
            mail.Body += "<table>";
            mail.Body += "<tr>";
            mail.Body += "<td>User Name : </td><td>" + username + "</td>";
            mail.Body += "</tr>";
            mail.Body += "<tr>";
            mail.Body += "<td>Fees : </td><td> " + sqlFeesValue.ToString() +"</td>";
            mail.Body += "</tr>";
            mail.Body += "</table>";
            mail.Body += "</body>";
            mail.Body += "</html>";
            smtp.Port = 465;
            smtp.Credentials = new System.Net.NetworkCredential("email@gmail.com", "passwd");
            smtp.EnableSsl = true;                
            smtp.UseDefaultCredentials = true;
            smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
            smtp.Send(mail);
        }
        catch (Exception error)
        {
            lblMessage.Visible = true;
            lblMessage.Text = error.Message;
        }
Thanks in advance
 
    