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; + } } }