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
selvi jp
NA
323
77.7k
sending otp in email after submit form
May 18 2021 12:50 PM
i am done email sending after submit the form.but i can`t send otp to email.
[AllowAnonymous]
[Route(
"Register"
)]
public
async Task<IHttpActionResult> Register(RegisterBindingModel model)
{
if
(!ModelState.IsValid)
{
return
BadRequest(ModelState);
}
var user =
new
ApplicationUser() { UserName = model.Email, Email = model.Email };
IdentityResult result = await UserManager.CreateAsync(user, model.Password);
if
(!result.Succeeded)
{
return
GetErrorResult(result);
}
MailMessage mm =
new
MailMessage(
"fromemail"
,
"toemail"
);
mm.Subject =
"Leave Reject"
;
mm.Body =
"Hi Sir, "
;
mm.IsBodyHtml =
false
;
SmtpClient smtp =
new
SmtpClient();
smtp.Host =
"smtp.gmail.com"
;
smtp.Port = 587;
smtp.UseDefaultCredentials =
false
;
smtp.Credentials =
new
System.Net.NetworkCredential(
"email"
,
"password"
);
smtp.EnableSsl =
true
;
smtp.Send(mm);
return
Ok();
}
Reply
Answers (
2
)
How to configure/connect REST API's using C# and Angular?
how to use sql query for optimizing application