Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
0
Reply
How to pass the random number into mail in MVC 5
Muhammad Tayyab
Jan 24 2018 4:18 AM
119
Reply
public ActionResult forgetPass(ChangePasswordModel obj)
{
DemoContext _context = new DemoContext();
User objUser = _context.Users.SingleOrDefault(x => x.EmailID.Equals(obj.CurrentEmail));
if(objUser!=null)
{
Random R = new Random();
int Rend = R.Next(100, 1000);
TempData["GenerateNo"] = Rend;
TempData.Keep();
//ViewBag.Gen = Rend;
//BuildEmailTemplate1(objUser.ID);
try
{
SmtpClient clt = new SmtpClient("smtp.myserver.com", 564);
clt.EnableSsl = true;
clt.Credentials = new NetworkCredential("
[email protected]
", "@@@123456789T");
clt.Send("
[email protected]
", objUser.EmailID, "WelCome to the OLX (Online Buying and selling)", "this is the Verification Code that we have send to you for the ");
}
catch(SmtpException ex)
{
// //error me
}
return RedirectToAction("UserProfile");
}
return View();
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
error on rdlc reporting???
sending mail in mvc