This commit is contained in:
PitzM 2025-02-26 15:03:48 +01:00
commit b5c470e1b9
3 changed files with 21 additions and 16 deletions

View File

@ -135,13 +135,18 @@ Namespace Mail
Private Function AddAttachments(pMailBuilder As Limilabs.Mail.MailBuilder, pAttachments As List(Of String)) As Limilabs.Mail.MailBuilder
For Each oAttachment In pAttachments
Try
' Read attachment from disk, add it to Attachments collection
If IO.File.Exists(oAttachment) Then
Logger.Debug("Adding attachment [{0}] to mail.", oAttachment)
pMailBuilder.AddAttachment(oAttachment)
If oAttachment <> String.Empty Then
' Read attachment from disk, add it to Attachments collection
If IO.File.Exists(oAttachment) Then
Logger.Debug("Adding attachment [{0}] to mail.", oAttachment)
pMailBuilder.AddAttachment(oAttachment)
Else
Logger.Warn("Attachment [{0}] does not exist. Skipping.", oAttachment)
End If
Else
Logger.Warn("Attachment [{0}] does not exist. Skipping.", oAttachment)
Logger.Debug("Attachment is String.Empty")
End If
Catch ex As Exception
Logger.Warn("Could not read or add attachment [{0}]!", oAttachment)
Logger.Error(ex)

View File

@ -157,7 +157,7 @@ Namespace Mail
End If
Catch ex As Exception
Logger.Warn("Error while connecting with Auth type OAuth2!")
Logger.Warn("Unexpected Error in ConnectToServer with Auth type OAuth2!")
Logger.Error(ex)
Session.Error = ex
@ -175,10 +175,10 @@ Namespace Mail
Logger.Debug("Connecting with [SSL/Connect] on [{0}/{1}]", pSession.Server, pSession.Port)
Client.Connect(pSession.Server, pSession.Port)
End If
Logger.Info("Connection Successful!")
Logger.Debug("Connection (AUTH_SSL) Successful!")
Catch ex As Exception
Logger.Warn("Error while connecting with Auth type SSL!")
Logger.Warn("Unexpected Error in ConnectToServer with Auth type SSL!")
Logger.Warn($"Error-message: {ex.Message}")
Logger.Error(ex)
@ -196,21 +196,21 @@ Namespace Mail
Logger.Debug("Connecting with [STARTTLS/Connect] on [{0}/{1}]", pSession.Server, pSession.Port)
Client.Connect(pSession.Server, pSession.Port)
End If
Logger.Info("Connection Successful!")
Logger.Debug("Connection (AUTH_SSLTLS or AUTH_STARTTLS) Successful!")
Dim oSupportsSTARTTLS As Boolean = SupportsSTARTTLS(Client)
Logger.Debug("Server supports STARTTLS: [{0}]", oSupportsSTARTTLS)
If oSupportsSTARTTLS Then
DoSTARTTLS(Client)
Logger.Info("STARTTLS Successful!")
Logger.Debug("STARTTLS Successful!")
Else
Logger.Debug("Server does not support STARTTLS. Enabling TLS1.2 instead.")
Client.SSLConfiguration.EnabledSslProtocols = Security.Authentication.SslProtocols.Tls12
End If
Catch ex As Exception
Logger.Warn("Error while connecting with Auth type STARTTLS!")
Logger.Warn("Unexpected Error in ConnectToServer with Auth type STARTTLS!")
Logger.Error(ex)
pSession.Error = ex
@ -221,9 +221,9 @@ Namespace Mail
Try
Logger.Debug("Auth type [{0}]. Using PLAINTEXT connection.", Session.AuthType)
Client.Connect(pSession.Server, pSession.Port, useSSL:=False)
Logger.Info("Connection Successful!")
Catch ex As Exception
Logger.Warn("Error while connecting with Auth type [{0}]!", Session.AuthType)
Logger.Warn("Unexpected Error in ConnectToServer with Auth type [{0}]!", Session.AuthType)
Logger.Error(ex)
pSession.Error = ex
@ -246,7 +246,7 @@ Namespace Mail
End If
Catch ex As Exception
Logger.Warn("Error while connecting with Auth type [{0}]!", pSession.AuthType)
Logger.Warn("Unexpected Error in ConnectToServer with Auth type [{0}]!", pSession.AuthType)
Logger.Error(ex)
pSession.Error = ex

View File

@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.9.6.0")>
<Assembly: AssemblyFileVersion("1.9.6.0")>
<Assembly: AssemblyVersion("1.9.7.0")>
<Assembly: AssemblyFileVersion("1.9.7.0")>