diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-11-29 07:35:24 +0100 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-11-29 07:35:24 +0100 |
| commit | a3bb4fcae1d339f0cae671b1c8a37c2236f32f4d (patch) | |
| tree | 6f63813797d87809cb946ea4b3c9aa42d8963ecc /code/api/src | |
| parent | 735d4c2bd46f809d43245e8eb8069c16d1bb3327 (diff) | |
| download | greatoffice-a3bb4fcae1d339f0cae671b1c8a37c2236f32f4d.tar.xz greatoffice-a3bb4fcae1d339f0cae671b1c8a37c2236f32f4d.zip | |
feat: Log response message from postmark
Diffstat (limited to 'code/api/src')
| -rw-r--r-- | code/api/src/Services/MailService.cs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/code/api/src/Services/MailService.cs b/code/api/src/Services/MailService.cs index 6073f6e..d160762 100644 --- a/code/api/src/Services/MailService.cs +++ b/code/api/src/Services/MailService.cs @@ -44,13 +44,9 @@ public class MailService throw new ArgumentNullException(nameof(message), "Both HtmlBody and TextBody is empty, nothing to send"); } - using var client = new HttpClient() { - DefaultRequestHeaders = { - {"X-Postmark-Server-Token", _postmarkToken}, - } - }; // TODO: Log response if unsuccessful - await client.PostAsJsonAsync("https://api.postmarkapp.com/email", message); + var response = await _httpClient.PostAsJsonAsync("https://api.postmarkapp.com/email", message); + _logger.LogInformation("Postmark returned with message: {0}", (await response.Content.ReadFromJsonAsync<PostmarkSendResponse>()).Message); } catch (Exception e) { _logger.LogError(e, "An exception occured while trying to send an email"); } |
