Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I tried all emails but it is not working.
- **HomeController.cs**
- [HttpPost]
- public ActionResult Contact(Registration reg)
- {
- if (ModelState.IsValid)
- {
- WebMail.Send(""
- , reg.Name + "is",
- reg.Message + "<br></br> My Number : "+reg.Mobile+
- "<br></br> My email is " +reg.Email
- ,null
- ,null
- ,null
- ,true
- ,null
- ,null
- ,null
- ,null
- ,null
- ,reg.Email);
- }
- return View();
- }
- **Web.config**
- <system.net>
- <mailSettings>
- <smtp>
- <network host="smtp.gmail.com"
- port="587"
- userName=""
- password=""
- enableSsl="true"
- />
- </smtp>
- </mailSettings>
- </system.net>
- **Contact.cshtml**
- @using (Html.BeginForm())
- {
- <p>Name: @Html.TextBoxFor(model => model.Name)</p>
- <p>Email: @Html.TextBoxFor(model => model.Email)</p>
- <p>Mobile: @Html.TextBoxFor(model => model.Mobile)</p>
- <p>Message:</p>
- <p>@Html.TextAreaFor(model => model.Message)</p>
- <p>
- <input type="submit" value="Submit" />
- </p>
- }
- even though i put all email, it was not working.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement