NguyenThai 0 Newbie Poster

I have started with ASP.Net just 1 month. Right now, my project may implement the control that users can recovery their password by answering question. We all know that Visual Studio or Visual Web Developer has a control name Password Recovery Control, just drag and drop. So far I have set user in my ASP.Net Web Administration. But according to 1 video that I already seen, when we add new user or role within the project or website, the project will generate the database to store that, but I never seen that one on my project. Second thing that I have trouble is sending an email. Actually, I don't have any SMTP mail server, so I use Gmail instead. I know that Gmail use SSL, but on the property of Password Recovery Control doesn't have the property to see SSL enable. So I work around by using event Sending Mail, but it causes error. Here my code, and I just want to send to user a simple email that say his password is something.

System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage("mygmail@gmail.com",  e.Message.To.ToString(), e.Message.Subject.ToString(), e.Message.Body.ToString());
msg.Priority = System.Net.Mail.MailPriority.High;
System.Net.Mail.SmtpClient smtpSender = new System.Net.Mail.SmtpClient("smtp.google.com", 587);
smtpSender.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtpSender.Credentials = new System.Net.NetworkCredential("mygmail@gmail.com", "mypassword");
smtpSender.EnableSsl = true;
smtpSender.Send(e.Message); ->> this cause error
e.Cancel = true;