public async Task <ActionResult <UserAccountDto> > Register([FromBody] RegisterUserDto registerDto, CancellationToken cancellationToken) { //if(!await _recaptchaService.Validate(registerDto.RecaptchaToken, cancellationToken)) // throw new AppException("The recaptcha was failed",true); var userDto = await _appAuthService.RegisterAsync(registerDto, cancellationToken); //TODO: this code commented due to error from google that says tooweekawutontication. less secure apps await _mailer.SendAsync(new UserEmailActivationEmail(userDto, $"{_appSetting.ApiBaseUrl}/api/public/VerifyEmail/", _appSetting.AdminEmailAddress)); return(userDto); }
public async Task <IActionResult> Signup([FromBody] SignupViewModel viewModel) { UserSignup userSignup = new UserSignup(context, viewModel.MapToUser()); await userSignup.SignupAsync(); if (userSignup.EmailAlreadyTaken) { return(new ErrorsJson("E-mail já cadastrado.")); } var viewResult = viewEngine.GetView(env.ContentRootPath, "~/Views/Emails/SignupEmail.cshtml", false); var htmlMessage = await new MailView(ControllerContext, viewResult) .ToHtmlAsync(new SignupEmail(userSignup.User, userSignup.ClosureRequest)); mailer.Recipients.Add(new MailRecipient(userSignup.User.Name, userSignup.User.Email)); taskHandler.ExecuteInBackground(async() => { await mailer.SendAsync("Bem vindo ao gestaoaju.com.br :)", htmlMessage); }); await HttpContext.SignInAsync(userSignup.User); return(new UserJson(userSignup.User)); }
private async Task SendMessageAsync(int emailId, Email email, CancellationToken token) { if (_sentMessageIds.Contains(emailId)) { return; } _sentMessageIds .Add(emailId); await _mailer .SendAsync(email, token, _logger); }
internal async Task SendAsync(RazorRenderer renderer, IMailer mailer) { this.Build(); string message = await this.BuildMessage(renderer, mailer).ConfigureAwait(false); await mailer.SendAsync( message, this._subject, this._to, this._from, this._replyTo, this._cc, this._bcc ).ConfigureAwait(false); }
public async Task <GenericResponse> TestMail(MailDto mailDto) { // Deneme amaçlı eklendi //ServiceResult service = await mailer.SendAsync(new string[]{"*****@*****.**","*****@*****.**"}, null, null, "test","denemem eerer", null); ServiceResult result = await mailer.SendAsync(mailDto.recipients, mailDto.bccList, mailDto.ccList, mailDto.subject, mailDto.body, mailDto.attachments); if (result.Success) { return(GenericResponse.Ok()); } else { return(GenericResponse.Error(ResultType.Error, result.Error, "TC_TM_01", StatusCodes.Status500InternalServerError)); } }
public async Task Invoke() { foreach (var user in await _userService.GetWeeklyStatsUserModels()) { var statsMailable = new WeeklyStatsMailable(new WeeklyStatsModel { Email = user.Email, Title = "Your weekly stats has arrived from SweatSpace", Content = _statsService.GetWeeklyWorkoutStats(user) }); await _mailer.SendAsync(statsMailable); _statsService.ResetWeeklyWorkoutStats(user); await _unitOfWork.SaveAllAsync(); } _logger.LogInformation($"Weekly mails sent"); }
public async Task Invoke() { foreach (var item in _repo.GetAllDue()) { if (item.DueDate <= DateTime.Now && !item.Sent) { try { await _mailer.SendAsync(new ReminderMailable(item)); item.Sent = true; } catch (Exception e) { _logger.LogError(e.Message, e); } } } }
private async Task SendNotificationMessageAsync(string destination, List <SharePointCommand> commands) { var message = new MailMessage { Subject = "ICC New authorizations have been assigned to you", From = new MailAddress("*****@*****.**", "ICC"), }; var recipients = _configuration.GetSection("EmailNotification").Get <List <string> >(); if (recipients != null && recipients.Any()) { // Test environment [Dev - Staging] recipients.ForEach(email => message.To.Add(new MailAddress(email))); } else { // Production environment message.To.Add(new MailAddress(destination)); } await _mailer.SendAsync(commands, "Mail/ICC", message); }
public async Task SendRegisterCodeEmail(string email, string url, string token) { await _mailer.SendAsync(email, "Register Veryfication", $"Confirm: '{url}?email={email}&token={token}'"); }
public async Task HandleAsync(NotifyUserEvent broadcast) => await _mailer.SendAsync( new UserEventEmail(broadcast.Message, _optionsValue.AdminEmailAddress));