Hi all. I'm not a beginner in VB .NET, but I'm writing my first Web application and something is not working properly. The entire code is pasted below, but to save time the relevant portions (I believe) are thus:

Dim smtpServer As String = "smtp.gmail.com"
.
.
Dim [txtBody, From_recipient1, To_recipient2, subject1] As String = [some text for each, this is my shorthand for 4 separate lines of code]
txtBody = [some text, not important]
.
.
.
Dim message1 As New MailMessage(From_recipient1, To_recipient2, subject1, txtBody)
message1.From = New MailAddress(recipient1)
message1.To.Add(recipient1) 'copy email to sender
message1.To.Add(recipient2) 'send email to recipient
message1.Subject = msg1 'msg1 defined earlier, not shown and not relevant
.
.
[THIS IS THE PART THAT THROWS AN EXCEPTION (BELOW). PARTICULARLY THE LAST LINE AND I CAN'T FIGURE OUT WHY...PLEASE HELP!!]
.
.
Dim SMTP As New SmtpClient(smtpServer)
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential("thirddcahs", "thirddcahs_pswd")
SMTP.Port = 465
SMTP.Send(message1)

[FULL CODE:]

Imports System.Net.Mail

Partial Class Registration_Form
Inherits System.Web.UI.Page

Dim smtpServer As String = "smtp.gmail.com"
Dim recipient1 As String = "[email protected]"
Dim recipient2 As String = "[email protected]"
Dim recipient3 As String
Dim subject1 As String = "Membership Request"
Dim subject2 As String = "Membership Subscription Receipt"
Dim msg1 As String = "Enrolling Member Information: "
Dim txtBody As String = ""
Protected Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles btnSubmit.Click
msgStat.Text = "Processing..."
'Try
Dim message1 As New MailMessage(From_recipient1, To_recipient2, subject1, txtBody)

message1.From = New MailAddress(recipient1)
message1.To.Add(recipient1)
message1.To.Add(recipient2)
message1.Subject = msg1

txtBody = "First Name: " & First_Name.Text & vbCrLf & "Last Name: " & Last_Name.Text & vbCrLf
If MI.Text <> "" Then
txtBody += "MI: " & MI.Text & vbCrLf
End If
If Organization.Text <> "" Then
txtBody += "Organization: " & Organization.Text & vbCrLf
End If
If Position.Text <> "" Then
txtBody += "Position: " & Position.Text & vbCrLf
End If
txtBody += "Address: " & Address.Text & vbCrLf
If Address_Cont.Text <> "" Then
txtBody += "Address (cont.): " & Address_Cont.Text & vbCrLf
End If
txtBody += "City: " & City.Text & vbCrLf & "State: " & State.Text & vbCrLf & "Zip: " & Zip.Text & vbCrLf
If Phone.Text <> "" Then
txtBody += "Phone: " & Phone.Text & vbCrLf
End If
If Fax.Text <> "" Then
txtBody += "Fax: " & Fax.Text & vbCrLf
End If
txtBody += "Email: " & Email.Text & vbCrLf

message1.Body = txtBody

Dim SMTP As New SmtpClient(smtpServer)
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential("thirddcahs", "thirddcahs_pswd")
SMTP.Port = 465
SMTP.Send(message1)

msgStat.Text = "Message Sent Successfully!" & vbCrLf & "You will receive an email receipt shortly. Thank you."
'Catch ex As Exception
'msgStat.Text = "There was an unexpected problem. Please contact us at [email protected]." & vbCrLf & "Error: " & ex.ToString()
'End Try
End Sub
End Class