I am calling a controller method SendMe(formCollection myForm){}. But I don't know how to pass Form that contains some information. I know how to read it, and also, how to call SendMe() on given controller, but I don't know how to pass it. Though, for the reference I am calling SendMe as:
<div id="menucontainer">
<ul id="menu">
<li><%: Html.ActionLink("Send", "SendMe", "Mail")%></li>
</ul>
</div>
and my SendMe method is:
public ActionResult SendMe(FormCollection Form)
{
string From = Form["From"].ToString();
string Pass = Form["Password"].ToString();
string To = Form["To"].ToString();
string Subject = Form["Subject"].ToString();
string Message = Form["Message"].ToString();
MailMessage nmsg = new MailMessage(From, To, Subject, Message);
nmsg.IsBodyHtml = true;
nmsg.Priority = MailPriority.High;
SmtpClient smtpc = new SmtpClient("smtp.gmail.com", 587);
smtpc.Credentials = new System.Net.NetworkCredential(From, Pass);
smtpc.EnableSsl = true;
smtpc.Send(nmsg);
return View();
}
I haven't put anything in Model, though, MailController and SendMe.aspx are in place.
tell me how to get through this. Thanks in advance.