diff options
Diffstat (limited to 'code/api/src/Services/MailService.cs')
| -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"); } |
