Public Async Function Register(model As RegisterViewModel) As Task(Of ActionResult)
If ModelState.IsValid Then
Dim user = New ApplicationUser() With {
.UserName = model.Email,
.Email = model.Email
}
Dim result = Await UserManager.CreateAsync(user, model.Password)
If result.Succeeded Then
Await SignInManager.SignInAsync(user, isPersistent:=False, rememberBrowser:=False)
' For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
' Send an email with this link
Dim code = Await UserManager.GenerateEmailConfirmationTokenAsync(user.Id)
Dim callbackUrl = Url.Action("ConfirmEmail", "Account", New With {.userId = user.Id, .code = code}, protocol:=Request.Url.Scheme)
UserManager.SendEmail(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=""" & callbackUrl & """>here</a>")
Return RedirectToAction("Index", "Home")
End If
AddErrors(result)
End If
' If we got this far, something failed, redisplay form
Return View(model)
End Function
This is the standard registration code
Now I've setup my SMTP in web.config and I even tested the details on other services/email programs and it worked
<system.net>
<mailSettings>
<smtp from="*@ziggo.nl" deliveryMethod="Network">
<network defaultCredentials="true" host="smtp.ziggo.nl" port="587" userName="*@ziggo.nl" password="*" enableSsl="true" />
</smtp>
</mailSettings>
</system.net>
Now this is the smtp settings I used. I had hidden my personal details with a * but I'm wondering why mail didn't get send with the UserManager.SendEmail