Gmail uses port 465 for SSL on SMTP.
Outgoing mail (SMTP) server smtp.gmail.com
Requires SSL: Yes
Requires TLS: Yes (if available)
Requires Authentication: Yes
Port for SSL: 465
Port for TLS/STARTTLS: 587
Aslso you Dim the smtp as a new smtpclient then assign it later with a new smtpcliet, one or the other will do and you can initialise the smtpclient on creation : smtp = new smtpclient(Server, Port).
Microsoft recommend NOT using smtpclient but alternatives like MailKit instead.
SmtpClient Class (System.Net.Mail) | Microsoft Docs[
^]