protected override async Task OnNotifyAsync(NotificationMessage message) { var smptClient = new SmtpClient(); var senderAddress = new MailAddress(Sender, SenderDisplayName); var mailMessage = new MailMessage() { Sender = senderAddress, From = senderAddress, Subject = message.Subject ?? "No subject", Body = message.SupportsHtmlBody ? message.CreateMessage() : message.CreateMessage(BodyType.PlainText), IsBodyHtml = message.SupportsHtmlBody, }; mailMessage.To.Add(new MailAddress(Target)); await smptClient.SendMailAsync(mailMessage); }
protected override async Task OnNotifyAsync(NotificationMessage message) { var request = new SlackWebhookRequest(WebhookUrl); var emojiMetaData = message.Metadata["slack-emoji"]; var payload = new SlackMessagePayloadData() { Text = message.CreateMessage() }; if (emojiMetaData != null) { payload.IconEmoji = emojiMetaData.Value.ToString(); } await request.ExecuteAsync(payload); }