private async Task SendRecoverEmail(string email, string userName) { var expires = DateTime.Now.AddHours(2); var issuer = _configuration["Issuer"]; var securityKey = _awsSecretManagerService.GetSecret(_configuration["SecretName_RecoverEmail"]); var claims = new[] { new System.Security.Claims.Claim(JwtRegisteredClaimNames.Sub, email), new System.Security.Claims.Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString("N")), new System.Security.Claims.Claim(JwtRegisteredClaimNames.UniqueName, email) }; var serializedToken = _securityTokenHandler.WriteToken(email, claims, issuer, securityKey, expires); var url = _configuration["PLAYERS2_URL"] + "newpassword?u17="; var template = ForgotPasswordTemplate.GetForgotPasswordBody(url + serializedToken); var emailTopic = _configuration["EMAIL_TOPIC"]; var message = new Message() { From = "*****@*****.**", Body = template, To = email, Subject = $"{userName}, change your password of PLAYER2 here!" }; await _snsClient.Send(emailTopic, JsonConvert.SerializeObject(new { Message = message })).ConfigureAwait(false); }
private async Task SendConfirmationEmail(string email, string userName) { var expires = DateTime.Now.AddDays(30); var issuer = _configuration["Issuer"]; var securityKey = _awsSecretManagerService.GetSecret(_configuration["SecretName_ConfirmEmail"]); var claims = new[] { new System.Security.Claims.Claim(JwtRegisteredClaimNames.Sub, email), new System.Security.Claims.Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString("N")), new System.Security.Claims.Claim(JwtRegisteredClaimNames.UniqueName, email) }; var serializedToken = _securityTokenHandler.WriteToken(email, claims, issuer, securityKey, expires); var url = _configuration["PLAYERS2_URL"] + "confirm.html?u19="; var template = CreateAccountTemplate.GetAcocuntsBody(url + serializedToken); var emailTopic = _configuration["EMAIL_TOPIC"]; var message = new Message() { From = "*****@*****.**", Body = template, To = email, Subject = $"Welcome to PLAYER2 {userName}! Please confirm your e-mail here" }; await _snsClient.Send(emailTopic, JsonConvert.SerializeObject(new { Message = message })).ConfigureAwait(false); }
private async Task SendOrderMail(User user, IEnumerable <Order> orders) { var template = OrdersTemplate.GetOrderBody(orders); var message = new Message() { Body = template, To = user.Email, Subject = $"{user.Name}, we have received your order", From = "*****@*****.**", Bcs = new List <string>() { "*****@*****.**" } }; await _snsClient.Send(_configuration["EMAIL_TOPIC"], JsonConvert.SerializeObject(new { Message = message })) .ConfigureAwait(false); }
internal override HandleResponse HandleIt(SnsCommand request, CancellationToken cancellationToken) { _snsClient.Send(request.TopicArn, request.Message).GetAwaiter().GetResult(); return(new HandleResponse()); }