From 311e4c3dc9c75af03456bc7d218e9879bcc0c6d9 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Mon, 23 Jan 2023 09:33:30 +0100 Subject: [PATCH] EmailService: Update to .NET 4.8, make tls version configurable --- Services.EmailService/App.config | 10 ++-- Services.EmailService/Config.vb | 2 + Services.EmailService/DDEmailService.vbproj | 4 +- Services.EmailService/EmailService.vb | 6 ++- .../My Project/Application.Designer.vb | 8 +-- .../My Project/Resources.Designer.vb | 49 ++++++++++--------- .../My Project/Settings.Designer.vb | 2 +- 7 files changed, 45 insertions(+), 36 deletions(-) diff --git a/Services.EmailService/App.config b/Services.EmailService/App.config index b327621d..e773d4eb 100644 --- a/Services.EmailService/App.config +++ b/Services.EmailService/App.config @@ -1,16 +1,16 @@ - + - + - - + + - \ No newline at end of file + diff --git a/Services.EmailService/Config.vb b/Services.EmailService/Config.vb index 7542cafe..9056a113 100644 --- a/Services.EmailService/Config.vb +++ b/Services.EmailService/Config.vb @@ -16,4 +16,6 @@ Public Class Config Public Property SQLServerTestConnectionString As String = "" Public Property Debug As Boolean = False + + Public Property TlsVersion As Security.Authentication.SslProtocols = Security.Authentication.SslProtocols.Default End Class diff --git a/Services.EmailService/DDEmailService.vbproj b/Services.EmailService/DDEmailService.vbproj index f584eba2..43eae557 100644 --- a/Services.EmailService/DDEmailService.vbproj +++ b/Services.EmailService/DDEmailService.vbproj @@ -11,8 +11,9 @@ DDEmailService 512 Console - v4.6.1 + v4.8 true + AnyCPU @@ -123,6 +124,7 @@ True Application.myapp + True ProjectInstaller.vb diff --git a/Services.EmailService/EmailService.vb b/Services.EmailService/EmailService.vb index 430ecbd7..97858f5e 100644 --- a/Services.EmailService/EmailService.vb +++ b/Services.EmailService/EmailService.vb @@ -348,7 +348,11 @@ Public Class EmailService ' ======= Connect to server ======= - Dim oResult = _MailSender.ConnectToServer(oAccount.Server, oAccount.Port, oAccount.Username, oAccount.Password, oAccount.AuthType) + Dim oOptions As New MailSender.MailSenderOptions() With { + .TlsVersion = _Config.TlsVersion + } + + Dim oResult = _MailSender.ConnectToServer(oAccount.Server, oAccount.Port, oAccount.Username, oAccount.Password, oAccount.AuthType, oOptions) If oResult = False Then _Logger.Warn("Could not connect to server. Skipping.") diff --git a/Services.EmailService/My Project/Application.Designer.vb b/Services.EmailService/My Project/Application.Designer.vb index 88dd01c7..8ab460ba 100644 --- a/Services.EmailService/My Project/Application.Designer.vb +++ b/Services.EmailService/My Project/Application.Designer.vb @@ -1,10 +1,10 @@ '------------------------------------------------------------------------------ ' -' This code was generated by a tool. -' Runtime Version:4.0.30319.42000 +' Dieser Code wurde von einem Tool generiert. +' Laufzeitversion:4.0.30319.42000 ' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. +' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +' der Code erneut generiert wird. ' '------------------------------------------------------------------------------ diff --git a/Services.EmailService/My Project/Resources.Designer.vb b/Services.EmailService/My Project/Resources.Designer.vb index c23c8759..b0c0aea7 100644 --- a/Services.EmailService/My Project/Resources.Designer.vb +++ b/Services.EmailService/My Project/Resources.Designer.vb @@ -1,40 +1,41 @@ '------------------------------------------------------------------------------ ' -' This code was generated by a tool. -' Runtime Version:4.0.30319.42000 +' Dieser Code wurde von einem Tool generiert. +' Laufzeitversion:4.0.30319.42000 ' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. +' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +' der Code erneut generiert wird. ' '------------------------------------------------------------------------------ Option Strict On Option Explicit On +Imports System Namespace My.Resources - - 'This class was auto-generated by the StronglyTypedResourceBuilder - 'class via a tool like ResGen or Visual Studio. - 'To add or remove a member, edit your .ResX file then rerun ResGen - 'with the /str option, or rebuild your VS project. + + 'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert + '-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. + 'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + 'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. ''' - ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. ''' - _ + _ Friend Module Resources - + Private resourceMan As Global.System.Resources.ResourceManager - + Private resourceCulture As Global.System.Globalization.CultureInfo - + ''' - ''' Returns the cached ResourceManager instance used by this class. + ''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. ''' - _ + _ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager Get If Object.ReferenceEquals(resourceMan, Nothing) Then @@ -44,17 +45,17 @@ Namespace My.Resources Return resourceMan End Get End Property - + ''' - ''' Overrides the current thread's CurrentUICulture property for all - ''' resource lookups using this strongly typed resource class. + ''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + ''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. ''' - _ + _ Friend Property Culture() As Global.System.Globalization.CultureInfo Get Return resourceCulture End Get - Set(ByVal value As Global.System.Globalization.CultureInfo) + Set resourceCulture = value End Set End Property diff --git a/Services.EmailService/My Project/Settings.Designer.vb b/Services.EmailService/My Project/Settings.Designer.vb index d1ed7ca5..a7bdc920 100644 --- a/Services.EmailService/My Project/Settings.Designer.vb +++ b/Services.EmailService/My Project/Settings.Designer.vb @@ -15,7 +15,7 @@ Option Explicit On Namespace My _ Partial Friend NotInheritable Class MySettings Inherits Global.System.Configuration.ApplicationSettingsBase