Hey Imar,
For the life of me I could not get your code to work for sending out an email. I understood the code and it made perfect sense, but for some reason the way it was set up I kept getting errors on both my work PC and home PC which wouldn't allow me to send the email.
To get the code to work, I had to eliminate your instruction to insert code into the web config file and I just added these elements to the user control:
Dim mySmtpClient As New SmtpClient()
mySmtpClient.Host = "smtp.gmail.com"
mySmtpClient.Port = 587
mySmtpClient.Credentials = New System.Net.NetworkCredential("
[email protected]", "YourPassword")
mySmtpClient.EnableSsl = True
mySmtpClient.Send(myMessage)
Now I am not sure if I was getting the errors because the code you specified didn't take into account that email requires SSL and a port (I tried adding the port to the webconfig) but it never worked until I deleted the section out of the webconfig and added that bit of extra code to the user control.
Do you think this is a reasonable alternative to your method? Is it any less secure since my email information will be sitting there?
Thanks again