Problems sending mail through Create User Wizard Using gmail - VB

Hasse76

New member
Joined
Dec 16, 2009
Messages
1
Programming Experience
Beginner
Hi!

I am having probleming solving this.

I know that I can't enable ssl in web.config file but must do this in the codebehind of the control.

I have configured the web.config file with port, username, password and mailaddress. I have tried a

C# code snippet which worked with no problems, but i need it to be in vb. Can anyone tell me what is wrong? I get

no error messages, everything seems fine, but no mail is sent.

The code is:

Imports System

Imports System.Net.Mail

Imports System.Web.UI.WebControls

Partial Public Class Default2

Inherits System.Web.UI.Page

Protected Sub CreateUserWizard1_SendingMail(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MailMessageEventArgs) Handles CreateUserWizard1.SendingMail

Dim mySmtpClient As SmtpClient = New SmtpClient()

mySmtpClient.EnableSsl = True

mySmtpClient.Send(e.Message) e.Cancel = True

End Sub

End Class
 
Back
Top