Ejemplo n.º 1
0
        private async Task SendEmail(string emailAddress, Dictionary <string, dynamic> personalisation)
        {
            var notifyConfig = _keyValueService.GetByKey("notify");

            if (notifyConfig != null)
            {
                string apiKey = notifyConfig.apiKey;
                var    client = new NotifyClient(apiKey);

                string templateId = notifyConfig.templateIdGeneric;
                var    response   = await client.SendEmailAsync(
                    emailAddress,
                    templateId,
                    personalisation
                    );

                System.Console.WriteLine(JsonConvert.SerializeObject(response.content));
            }
            else
            {
                System.Console.WriteLine($@"
email: {emailAddress}
subject: {personalisation.GetValueOrDefault("subject")}
message: {personalisation.GetValueOrDefault("message")}
                ");
            }
        }