From 78fee640bcc81f8f578f417ab1504dd9618e7898 Mon Sep 17 00:00:00 2001 From: Rolf Kristensen Date: Wed, 30 Aug 2023 21:09:48 +0200 Subject: [PATCH] PickupDirectoryLocation - SmtpServer is no longer RequiredParameter (#179) --- src/NLog.MailKit/MailTarget.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/NLog.MailKit/MailTarget.cs b/src/NLog.MailKit/MailTarget.cs index 5140032..2c64cf1 100644 --- a/src/NLog.MailKit/MailTarget.cs +++ b/src/NLog.MailKit/MailTarget.cs @@ -177,7 +177,6 @@ public Layout Body /// Gets or sets SMTP Server to be used for sending. /// /// - [RequiredParameter] public Layout SmtpServer { get; set; } /// @@ -467,7 +466,12 @@ private void CheckRequiredParameters() var smtpAuthentication = RenderLogEvent(SmtpAuthentication, LogEventInfo.CreateNullEvent()); if (smtpAuthentication == SmtpAuthenticationMode.Ntlm) { - throw new NLogConfigurationException("NTLM not yet supported"); + throw new NLogConfigurationException("SmtpAuthentication NTLM not yet supported"); + } + + if (PickupDirectoryLocation is null && SmtpServer is null) + { + throw new NLogConfigurationException("SmtpServer is required"); } }