title: Sending Email using MVC 3
body: <p>I want to send email using an MVC 3 application. I have a user table named Reviewer in a database with email addresses. What I want is when I select 2-3 users from the table on the view using checkboxes, the email address for each user should be inserted automatically into the "Textbox" on the feedback view page, but it's not working. It's taking the value of <code>Webmail.Send()</code> from the controller instead of the feedback form page. Any ideas?</p>
  
  <pre><code> [HttpPost]
      public ActionResult Feedback(string email, string subject, string body)
      {
          try
          {
              WebMail.SmtpServer = "smtp.gmail.com";
              WebMail.EnableSsl = true;
              WebMail.SmtpPort = 25;
              WebMail.UserName = "myemail@gmail.com";
              WebMail.Password = "*******123";
              WebMail.From = "myemail@gmail.com";
              WebMail.Send(
                      "senderemail@yahoo.com",
                      subject,
                      body,
                      email 
                  );
  
              return RedirectToAction("FeedbackSent");
          }
          catch (Exception ex)
          {
              ViewData.ModelState.AddModelError("_FORM", ex.ToString());
          }
  
          return View();
      }
  </code></pre>
  
  <p>This is the View page of Feedback:</p>
  
  <pre><code>@using(Html.BeginForm()) {
      &lt;table&gt;
      &lt;tr&gt;
          &lt;td&gt;Your e-mail:&lt;/td&gt;
          &lt;td&gt;@Html.TextBox("email")&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Subject:&lt;/td&gt;
          &lt;td&gt;@Html.TextBox("subject")&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Body:&lt;/td&gt;
          &lt;td&gt;@Html.TextArea("body")&lt;/td&gt;
      &lt;/tr&gt;
      &lt;/table&gt;
      &lt;input type="submit" value="Send" /&gt;
  }
  </code></pre>