Integration of LimiLabs, Init
This commit is contained in:
@@ -1,22 +1,9 @@
|
||||
Imports Independentsoft
|
||||
Imports Limilabs.Mail
|
||||
Imports Limilabs.Mail.MSG
|
||||
Imports System.Text.RegularExpressions
|
||||
|
||||
Public Class ClassEmailHeaderExtractor
|
||||
''' <summary>
|
||||
''' Extrahiert die Headerinformationen aus einer .msg Datei mithilfe der MSG.NET Klasse
|
||||
''' </summary>
|
||||
''' <param name="path">Der Pfad einer .msg Datei</param>
|
||||
''' <returns>Headerinformationen als String oder Nothing wenn ein Fehler aufgetreten ist.</returns>
|
||||
Public Shared Function getMessageHeaders(path As String)
|
||||
Try
|
||||
Dim msg As New Msg.Message(path)
|
||||
Dim headers = msg.TransportMessageHeaders.Replace(vbCrLf, " ")
|
||||
Return headers
|
||||
Catch ex As Exception
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Extrahiert die Headerinformationen aus einem msg Objekt mithilfe der MSG.NET Klasse
|
||||
''' </summary>
|
||||
@@ -56,7 +43,7 @@ Public Class ClassEmailHeaderExtractor
|
||||
End Function
|
||||
Public Shared Function extractFromHeader(messageHeaders As String, Regex As String)
|
||||
Try
|
||||
Dim result
|
||||
Dim result = Nothing
|
||||
Dim i As Integer = 0
|
||||
If IsNothing(messageHeaders) Then
|
||||
Return Nothing
|
||||
@@ -68,6 +55,8 @@ Public Class ClassEmailHeaderExtractor
|
||||
' die Vorkommen im String auslesen
|
||||
For Each myMatch As Match In myRegex.Matches(strTargetString)
|
||||
If myMatch.Success Then
|
||||
LOGGER.Debug("Match success. Matched Value: [{0}]", myMatch.Value)
|
||||
|
||||
If myMatch.Value <> "" Then
|
||||
If i = 0 Then
|
||||
result = myMatch.Value.ToString
|
||||
@@ -76,14 +65,19 @@ Public Class ClassEmailHeaderExtractor
|
||||
End If
|
||||
i += 1
|
||||
End If
|
||||
Else
|
||||
LOGGER.Debug("Match failed!")
|
||||
End If
|
||||
Next
|
||||
|
||||
LOGGER.Debug("Extracted value: [{0}]", result)
|
||||
|
||||
Return result
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
MsgBox("Unexpected Error in extractFromHeader: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
|
||||
Reference in New Issue
Block a user