From 1a3c7bab2ad7deae0a778eb84b6d130df1bd9d36 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Wed, 7 Dec 2022 11:54:12 +0900 Subject: feat: Print email when debugging --- code/api/src/Services/MailService.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'code/api') diff --git a/code/api/src/Services/MailService.cs b/code/api/src/Services/MailService.cs index 6f9ff18..4d789dd 100644 --- a/code/api/src/Services/MailService.cs +++ b/code/api/src/Services/MailService.cs @@ -41,7 +41,9 @@ public class MailService if (message.HtmlBody.IsNullOrWhiteSpace() && message.TextBody.IsNullOrWhiteSpace()) { throw new ArgumentNullException(nameof(message), "Both HtmlBody and TextBody is empty, nothing to send"); } - +#if DEBUG + _logger.LogInformation("Sending email: {0}", JsonSerializer.Serialize(message, new JsonSerializerOptions() {WriteIndented = true})); +#endif var response = await _httpClient.PostAsJsonAsync("https://api.postmarkapp.com/email", message); _logger.LogInformation("Postmark returned with message: {0}", (await response.Content.ReadFromJsonAsync()).Message); } catch (Exception e) { -- cgit v1.3