I have this issue and dont know how to resolve it on my Register ActionResult, kindly please assist me.
- [HttpPost]  
 -         [AllowAnonymous]  
 -         [ValidateAntiForgeryToken]  
 -         public async Task<ActionResult> Register(RegisterViewModel model)  
 -         {  
 -             if (ModelState.IsValid)  
 -             {  
 -                 var user = new ApplicationUser() { UserName = model.UserName };  
 -                 user.Email = model.Email;  
 -                 user.ConfirmedEmail = false;  
 -                 var result = await UserManager.CreateAsync(user, model.Password);  
 -                 if (result.Succeeded)  
 -                 {  
 -                      
 -   
 -   
 -                     MailMessage msg = new MailMessage();  
 -   
 -                     msg.From = new MailAddress("[email protected]");  
 -                     msg.To.Add("[email protected]");  
 -                     msg.Subject = "test";  
 -                     msg.Body = "Test Content";  
 -                     
 -                     using (SmtpClient client = new SmtpClient())  
 -                     {  
 -                         client.EnableSsl = true;  
 -                         client.UseDefaultCredentials = true;  
 -                         client.Credentials = new NetworkCredential("[email protected]", "Mohali@5050");  
 -                         client.Host = "smtp.gmail.com";  
 -                         client.Port = 587;  
 -                          
 -   
 -                         client.Send(msg);  // This gets thrown as an error, yes google settings are set all of them.
 -                     }  
 -   
 -                     return RedirectToAction("Confirm", "Account", new { Email = user.Email });  
 -                 }  
 -                 else  
 -                 {  
 -                     AddErrors(result);  
 -                 }  
 -             }  
 -   
 -               
 -             return View(model);  
 -         }