From 3a8ddce394307b032175e0ca2fdab41af4458884 Mon Sep 17 00:00:00 2001 From: Tudor Stanciu Date: Sat, 21 Jan 2023 13:51:21 +0200 Subject: [PATCH] EmailMessage log extension fix --- src/Correo.Abstractions/Extensions/ModelExtensions.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Correo.Abstractions/Extensions/ModelExtensions.cs b/src/Correo.Abstractions/Extensions/ModelExtensions.cs index 6fc3d9a..1b3658d 100644 --- a/src/Correo.Abstractions/Extensions/ModelExtensions.cs +++ b/src/Correo.Abstractions/Extensions/ModelExtensions.cs @@ -9,6 +9,13 @@ namespace Correo.Abstractions.Extensions => addresses != null ? string.Join(',', addresses.Select(z => z.Address)) : string.Empty; public static string Log(this EmailMessage message) - => $"Email sent: Subject: {message.Subject}; From: {message.From.Address}; To: {message.To.Log()}; Cc: {message.Cc.Log()}; Bcc: {message.Bcc.Log()};"; + { + var msg = $"Email sent: Subject: {message.Subject}; From: {message.From.Address}; To: {message.To.Log()};"; + if (message.Cc != null) + msg += $" Cc: {message.Cc.Log()};"; + if (message.Bcc != null) + msg += $" Bcc: {message.Bcc.Log()};"; + return msg; + } } }