From 4e73190ae5c9ceaa2c9030e3d1fbd2ba598bcba2 Mon Sep 17 00:00:00 2001 From: Hermes Sbicego Date: Fri, 10 Nov 2023 08:49:36 +0100 Subject: [PATCH] Makes upgrade to Mailkit fully backward compatible --- .../Modules/Orchard.Email/Models/SmtpSettingsPart.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Email/Models/SmtpSettingsPart.cs b/src/Orchard.Web/Modules/Orchard.Email/Models/SmtpSettingsPart.cs index b710cf881..d69c0c2b9 100644 --- a/src/Orchard.Web/Modules/Orchard.Email/Models/SmtpSettingsPart.cs +++ b/src/Orchard.Web/Modules/Orchard.Email/Models/SmtpSettingsPart.cs @@ -37,7 +37,7 @@ namespace Orchard.Email.Models { public SmtpEncryptionMethod EncryptionMethod { #pragma warning disable CS0618 // Type or member is obsolete // Reading EnableSsl is necessary to keep the correct settings during the upgrade to MailKit. - get { return this.Retrieve(x => x.EncryptionMethod, EnableSsl ? SmtpEncryptionMethod.SslTls : SmtpEncryptionMethod.None); } + get { return this.Retrieve(x => x.EncryptionMethod, EnableSsl ? (Port == 587 ? SmtpEncryptionMethod.StartTls : SmtpEncryptionMethod.SslTls) : SmtpEncryptionMethod.None); } #pragma warning restore CS0618 // Type or member is obsolete set { this.Store(x => x.EncryptionMethod, value); } } @@ -82,4 +82,4 @@ namespace Orchard.Email.Models { return true; } } -} \ No newline at end of file +}