public async Task <IActionResult> SendMail([FromServices] ISendMailService mailService, string mail, string name, string subject, string maintext) { var user = await LoginUserHelperManager.GetCurrentUser(); MailUserDto Receiver = new MailUserDto() { Mail = mail, Username = mail, }; MailUserDto Sender = new MailUserDto() { Mail = user.User.Mail, Username = user.UserName }; MailMessageDto Message = new MailMessageDto { subject = subject, text = maintext, }; await mailService.SentMail(Sender, Receiver, Message); return(RedirectToAction("StudentView")); }
public async Task <IActionResult> ForgotenPassword([FromServices] ISendMailService mailService, [FromServices] ISchoolHelperManager manager, string username) { var ReceiveAccount = await manager.SearchAccount(username); MailUserDto Receiver = new MailUserDto() { Username = username, Mail = ReceiveAccount.User.Mail }; MailUserDto Sender = new MailUserDto() { Username = "******", Mail = "*****@*****.**", }; MailMessageDto Message = new MailMessageDto() { subject = "Password", text = $"Your password is {ReceiveAccount.Password}" }; await mailService.SentMail(Sender, Receiver, Message); return(RedirectToAction("Login")); }