TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Muhammad Tayyab
NA
96
553
How to pass the random number into mail in MVC 5
Jan 24 2018 4:18 AM
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();
}
Reply
Answers (
0
)
error on rdlc reporting???
sending mail in mvc