From c0d92b80bbbaba46175618f59c5f08c574c08f1e Mon Sep 17 00:00:00 2001 From: Drew Green Date: Thu, 18 Jul 2024 15:47:40 -0400 Subject: [PATCH] Added ability to use insecure connections to SMTP server. --- .vscode/launch.json | 5 +++-- Services/Mail2GotifyService.cs | 5 +++-- appsettings.json | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 5b33a2b..5f74923 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,11 +6,12 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build", - "program": "${workspaceFolder}/bin/Debug/net7.0/Mail2Gotify.dll", + "program": "${workspaceFolder}/bin/Debug/net8.0/Mail2Gotify.dll", "args": [], "cwd": "${workspaceFolder}", "console": "internalConsole", - "stopAtEntry": false + "stopAtEntry": false, + "justMyCode": false }, { "name": ".NET Core Attach", diff --git a/Services/Mail2GotifyService.cs b/Services/Mail2GotifyService.cs index a4fa784..579c45e 100644 --- a/Services/Mail2GotifyService.cs +++ b/Services/Mail2GotifyService.cs @@ -66,11 +66,12 @@ public async Task StartAsync(CancellationToken cancellationToken) .Endpoint(builder => builder .Port(_configuration.GetValue("Services:Mail2Gotify:HostPort")) - .IsSecure(true) + .IsSecure(_configuration.GetValue("Services:Mail2Gotify:Secure")) + .AllowUnsecureAuthentication(true) .AuthenticationRequired() .SupportedSslProtocols(System.Security.Authentication.SslProtocols.Tls12 | System.Security.Authentication.SslProtocols.Tls13) .Certificate(x509Certificate)) - .Build(); + .Build(); ServiceProvider serviceProvider = new(); serviceProvider.Add(_gotifyMessageStore); diff --git a/appsettings.json b/appsettings.json index 0cd7309..281d5a6 100644 --- a/appsettings.json +++ b/appsettings.json @@ -10,6 +10,7 @@ "Mail2Gotify": { "HostAddress": "", "HostPort": 587, + "Secure": true, "CacheDirectory": "", "CertLocation": "", "KeyLocation": "", @@ -25,4 +26,4 @@ "Name": "Mail2Gotify", "Password": "" } -} \ No newline at end of file +}