private static string GetConfirmationUri(UpdaterOrchestratorData activationData) { var queryParameters = new Dictionary <string, string>(); queryParameters["id"] = activationData.InstanceId; return(QueryHelpers.AddQueryString(Environment.GetEnvironmentVariable("HostUrl") + "/ConfirmChange", queryParameters)); }
public SendGridMessage CreateUpdateMessage(UpdaterOrchestratorData activationData) { SendGridMessage message = new SendGridMessage() { Subject = $"Ticker informator update" }; message.From = _sender; message.AddTo(activationData.SubmitInfo.Email); message.AddContent("text/html", $"Update info: {GetConfirmationUri(activationData)}"); return(message); }
public static async Task <SendGridMessage> SendConfirmationEmail( [ActivityTrigger] UpdaterOrchestratorData orchestratorData, [Table("Subscribers")] CloudTable subscribersTable, [Inject] IEmailComposer emailComposer, ILogger log) { log.LogInformation($"SendConfirmationEmail to: {orchestratorData.SubmitInfo.Email}"); string[] emailSplited = orchestratorData.SubmitInfo.Email.Split("@"); if (emailSplited.Length != 2) { return(null); } SubscriberInfo subscriberInfo = await subscribersTable.GetTableEntity <SubscriberInfo>(emailSplited[1], emailSplited[0]); return(subscriberInfo == null?emailComposer.CreateActivationMessage(orchestratorData) : emailComposer.CreateUpdateMessage(orchestratorData)); }