Your code looks fine to me, and it should send the email (and of course, should connect to the server), did you try connecting through the default TCP port for SMTP communication? That is 25, consider trying that one out,
using (SmtpClient smtp = new SmtpClient("smtp.gmail.com", 25))
Other than that, only a few things to consider:
1) Is SMTP enabled in the gmail settings?
2) Is firewall blocking your communication to that IP address/port from your application. This can really matter a lot.
3) Is Google permitting your account to communicate, sometimes I have also found that Google doesn't allow specific applications to use SMTP services.
Other than that, there is very less we can look into. One more thing, kindly try to connect to Outlook or Yahoo! accounts and see if they are working —
code looks fine.
Sending emails over .NET framework, and general problems – using C# code[
^].