Hi, since you're using old methods of C# that people don't use anymore in ASP.NET, you need to update the code, and use the ASP.NET version of the code.
I have written an article, about sending emails in ASP.NET and it focuses the Gmail accounts.
Sending Emails Easily Using ASP.NET Helpers[
^]
The major part, is the port number you're connecting through, and that the connection would be secure, in ASP.NET you do that using
WebMail.EnablSsl = true;
..then you continue. Read the article, it has the working code sample. You can test it too, and also it has some explaination of the basic concepts of sending the emails in ASP.NET using gmail accounts.