summaryrefslogtreecommitdiffstats
path: root/src/main.lib/Services/NotificationService.cs
diff options
context:
space:
mode:
authorWouter Tinus <wouter.tinus@gmail.com>2020-06-08 21:02:17 +0200
committerWouter Tinus <wouter.tinus@gmail.com>2020-06-08 21:02:17 +0200
commit9f949e8b2e5ecd4e696ec5e72a7e1edc69bddb4c (patch)
tree85d89bd1f9217dfe7ee71004a9610574cae1e529 /src/main.lib/Services/NotificationService.cs
parent46ddef738ef89ecc11c706a103bc09b235165993 (diff)
downloadletsencrypt-win-simple-9f949e8b2e5ecd4e696ec5e72a7e1edc69bddb4c.zip
letsencrypt-win-simple-9f949e8b2e5ecd4e696ec5e72a7e1edc69bddb4c.tar.gz
letsencrypt-win-simple-9f949e8b2e5ecd4e696ec5e72a7e1edc69bddb4c.tar.bz2
make email client QUIT the connection nicely
Diffstat (limited to 'src/main.lib/Services/NotificationService.cs')
-rw-r--r--src/main.lib/Services/NotificationService.cs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main.lib/Services/NotificationService.cs b/src/main.lib/Services/NotificationService.cs
index cff3803..7795fac 100644
--- a/src/main.lib/Services/NotificationService.cs
+++ b/src/main.lib/Services/NotificationService.cs
@@ -5,6 +5,7 @@ using Serilog.Events;
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Threading.Tasks;
using System.Web;
namespace PKISharp.WACS.Services
@@ -33,7 +34,7 @@ namespace PKISharp.WACS.Services
/// </summary>
/// <param name="runLevel"></param>
/// <param name="renewal"></param>
- internal void NotifyCreated(Renewal renewal, IEnumerable<MemoryEntry> log)
+ internal async Task NotifyCreated(Renewal renewal, IEnumerable<MemoryEntry> log)
{
// Do not send emails when running interactively
_log.Information(
@@ -42,7 +43,7 @@ namespace PKISharp.WACS.Services
renewal.LastFriendlyName);
if (_settings.Notification.EmailOnSuccess)
{
- _email.Send(
+ await _email.Send(
$"Certificate {renewal.LastFriendlyName} created",
@$"<p>Certificate <b>{HttpUtility.HtmlEncode(renewal.LastFriendlyName)}</b> succesfully created.</p>
{NotificationInformation(renewal)}
@@ -56,7 +57,7 @@ namespace PKISharp.WACS.Services
/// </summary>
/// <param name="runLevel"></param>
/// <param name="renewal"></param>
- internal void NotifySuccess(Renewal renewal, IEnumerable<MemoryEntry> log)
+ internal async Task NotifySuccess(Renewal renewal, IEnumerable<MemoryEntry> log)
{
// Do not send emails when running interactively
_log.Information(
@@ -65,7 +66,7 @@ namespace PKISharp.WACS.Services
renewal.LastFriendlyName);
if (_settings.Notification.EmailOnSuccess)
{
- _email.Send(
+ await _email.Send(
$"Certificate renewal {renewal.LastFriendlyName} completed",
@$"<p>Certificate <b>{HttpUtility.HtmlEncode(renewal.LastFriendlyName)}</b> succesfully renewed.</p>
{NotificationInformation(renewal)}
@@ -79,7 +80,7 @@ namespace PKISharp.WACS.Services
/// </summary>
/// <param name="runLevel"></param>
/// <param name="renewal"></param>
- internal void NotifyFailure(
+ internal async Task NotifyFailure(
RunLevel runLevel,
Renewal renewal,
List<string> errors,
@@ -93,7 +94,7 @@ namespace PKISharp.WACS.Services
}
if (runLevel.HasFlag(RunLevel.Unattended))
{
- _email.Send(
+ await _email.Send(
$"Error processing certificate renewal {renewal.LastFriendlyName}",
@$"<p>Renewal for <b>{HttpUtility.HtmlEncode(renewal.LastFriendlyName)}</b> failed, will retry on next run.<br><br>Error(s):
<ul><li>{string.Join("</li><li>", errors.Select(x => HttpUtility.HtmlEncode(x)))}</li></ul></p>