public async Task <bool> SendUploadProcessedNotification(IUploadProcessedNotification notification, CancellationToken cancellationToken) { INotificationClient client = NotificationClient(); if (notification.UploadSuccessfullyProcessed) { client.SendEmail(notification.Email, ProcessSuccessfulTemplateId()); } else { client.SendEmail(notification.Email, ProcessUnsuccessfulTemplateId()); } return(true); }
public async Task SendEmail(string templateName, string toAddress, dynamic tokens, string replyToAddress) { //TODO: Pass in INotificationClient to ctor, create transient with ApiKey //var client = new NotificationClient(_configuration.GovNotifyApiKey); var emailTemplate = await _emailTemplateRepository.GetEmailTemplate(templateName); //TODO: Make sure the id is the one we expectGet template from db //var templateId = "192e704d-a5db-4f77-9b20-4eb9cdff5501"; if (emailTemplate != null) { var personalisationTokens = new Dictionary <string, dynamic>(); foreach (var property in tokens.GetType().GetProperties()) { personalisationTokens[property.Name] = property.GetValue(tokens); } //TODO: Set up replytoid - see on https://docs.notifications.service.gov.uk/net.html#send-an-email-arguments-personalisation-optional _notificationClient.SendEmail( emailAddress: toAddress, templateId: emailTemplate.TemplateId, personalisation: personalisationTokens); } }
public Either <ActionResult, Unit> SendEmail( string email, string templateId, Dictionary <string, dynamic> values) { try { _client.SendEmail(emailAddress: email, templateId: templateId, personalisation: values); // TODO EES-2752 This returns an EmailNotificationResponse containing a message id which we could store // if we decide to retrieve and display the delivery status of emails return(Unit.Instance); } catch (Exception e) { _logger.LogError(e, "Exception occured while sending email"); return(new BadRequestResult()); } }
public async Task SendEmail(string domain, string emailAddress, string templateId, string sessionId) { var personalisation = GetPersonalisation(domain, sessionId); var response = NotificationClient.SendEmail(emailAddress, templateId, personalisation); await Task.CompletedTask; }
public void SendEmail(string email, string templateId, Dictionary <string, dynamic> values) { _client.SendEmail(emailAddress: email, templateId: templateId, personalisation: values); }