Hello all I have a creatuserwizard on my asp.net site that fires off an email when someone registers that requires them to click a link to activate the account. That all works fine.
I have the MailDefinition setup on the control itself that builds the body of the email, sender etc. In my webconfig I have the mailsettings for server host, port, sending user,, etc.
On the sedndingmail event I have the following code. I always get 2 copies of the email. What am I doing wrong in teh code below that is causing it? I can't seem to eliminate the right line.
Dim newUserAccount As MembershipUser = Membership.GetUser(CreateUserWizard1.UserName)
Dim newUserAccountId As Guid = DirectCast(newUserAccount.ProviderUserKey, Guid)
Dim domainName As String = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath
Dim confirmationPage As String = "/account/EmailVerification.aspx?UserID=" & newUserAccountId.ToString()
Dim url As String = domainName & confirmationPage
e.Message.Body = e.Message.Body.Replace("<%VerificationUrl%>", url)
Dim obj As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient
Dim Mailmsg As New System.Net.Mail.MailMessage
obj.EnableSsl = True
'ADD ADDRESSES, SUBJECT, BODY
e.Cancel = True