I am trying to setup MVCMailer to use the Email and UserId that were setup when they registered with the website. I used the stock MVC framework to setup the user registration framework and thus the ASPNETDB.MDF DB is used to keep track of email userID and password. I am stuck at the moment on how to pull the current user id and email out of the DB so MVCMailer knows where to send the email with the password reset instructions. Below is my attempt at getting the data out of the DB and into the send mail function. I know I am wrong because I have red squiggles below the word membership.
public virtual MailMessage Welcome(string ADID)
{
var mailMessage = new MailMessage{Subject = "Welcome"};
mailMessage.To.Add(membership.Email);
ViewBag.Name = membership.UserId;
PopulateBody(mailMessage, viewName: "Welcome");
return mailMessage;
}
Does anyone have any idea how to do this I have been searching for a couple hours now on how to accomplish this with no luck. The tutorials I have looked at all seem to use hard coded values for where to send an email. Please let me know if you need any other code and Thanks for your help!