|
|
|
@@ -770,8 +770,7 @@ Public Class frmMain
|
|
|
|
ConfigManager.Save()
|
|
|
|
ConfigManager.Save()
|
|
|
|
My.Settings.Save()
|
|
|
|
My.Settings.Save()
|
|
|
|
Cursor = Cursors.WaitCursor
|
|
|
|
Cursor = Cursors.WaitCursor
|
|
|
|
Dim PWPlain = _Encryption.DecryptData(EMAIL_PWTextBox.Text)
|
|
|
|
|
|
|
|
'NEW
|
|
|
|
|
|
|
|
_MailSender = New Mail.MailSender(LogConfig)
|
|
|
|
_MailSender = New Mail.MailSender(LogConfig)
|
|
|
|
Dim oDefault As Boolean = True
|
|
|
|
Dim oDefault As Boolean = True
|
|
|
|
If CheckBoxEnableTls1_1.Checked Or CheckBoxEnableTls1_2.Checked Then
|
|
|
|
If CheckBoxEnableTls1_1.Checked Or CheckBoxEnableTls1_2.Checked Then
|
|
|
|
@@ -783,40 +782,48 @@ Public Class frmMain
|
|
|
|
.EnableDefault = oDefault
|
|
|
|
.EnableDefault = oDefault
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Logger.Debug($"oOptions: oOptions.EnableTls1_1: {oOptions.EnableTls1_1}, oOptions.EnableTls1_2: {oOptions.EnableTls1_2}, oOptions.EnableDefault: {oOptions.EnableDefault}")
|
|
|
|
Logger.Debug($"oOptions: oOptions.EnableTls1_1: {oOptions.EnableTls1_1}, oOptions.EnableTls1_2: {oOptions.EnableTls1_2}, oOptions.EnableDefault: {oOptions.EnableDefault}")
|
|
|
|
Dim oResult As Mail.MailSession.SessionInfo = _MailSender.Connect(EMAIL_SMTPTextBox.Text, PORTTextBox.Text, EMAIL_USERTextBox.Text, PWPlain, AUTH_TYPEComboBox.Text, oOptions)
|
|
|
|
|
|
|
|
|
|
|
|
Dim oResult As Mail.MailSession.SessionInfo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
' OAuth2 oder Standard-Authentifizierung
|
|
|
|
|
|
|
|
If AUTH_TYPEComboBox.Text = "OAUTH2" Then
|
|
|
|
|
|
|
|
' OAuth2-Variablen aus DB-Feldern (analog zu btntestImap)
|
|
|
|
|
|
|
|
Dim oClientId = EMAIL_SMTPTextBox.Text
|
|
|
|
|
|
|
|
Dim oClientSecret = _Encryption.DecryptData(EMAIL_PWTextBox.Text)
|
|
|
|
|
|
|
|
Dim oTenantId = ARCHIVE_FOLDERTextBox.Text
|
|
|
|
|
|
|
|
Dim oUser = EMAIL_USERTextBox.Text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
oResult = _MailSender.ConnectToO365(oUser, oClientId, oTenantId, oClientSecret)
|
|
|
|
|
|
|
|
Else
|
|
|
|
|
|
|
|
' Standard-Authentifizierung (bestehend)
|
|
|
|
|
|
|
|
Dim PWPlain = _Encryption.DecryptData(EMAIL_PWTextBox.Text)
|
|
|
|
|
|
|
|
oResult = _MailSender.Connect(EMAIL_SMTPTextBox.Text, PORTTextBox.Text, EMAIL_USERTextBox.Text, PWPlain, AUTH_TYPEComboBox.Text, oOptions)
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
If oResult.Connected = False Then
|
|
|
|
If oResult.Connected = False Then
|
|
|
|
Cursor = Cursors.Default
|
|
|
|
Cursor = Cursors.Default
|
|
|
|
MsgBox("Could not create a MailSession / connect to server. Please check the log.", MsgBoxStyle.Exclamation)
|
|
|
|
MsgBox("Could not create a MailSession / connect to server. Please check the log.", MsgBoxStyle.Exclamation)
|
|
|
|
Exit Sub
|
|
|
|
Exit Sub
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
Dim oAddresses As List(Of String) = txtTestmail.Text.Split(";").ToList()
|
|
|
|
Dim oAddresses As List(Of String) = txtTestmail.Text.Split(";").ToList()
|
|
|
|
Dim oAddedWhen = Now
|
|
|
|
Dim oAddedWhen = Now
|
|
|
|
Dim oAttachments As New List(Of String)
|
|
|
|
Dim oAttachments As New List(Of String)
|
|
|
|
Dim oBody As String = $"This is just a template body (text will be replaced within the run) - ProfileID: {EMAILIDTextBox.Text}"
|
|
|
|
Dim oBody As String = $"This is just a template body (text will be replaced within the run) - ProfileID: {EMAILIDTextBox.Text}"
|
|
|
|
Dim oMessageSent = _MailSender.SendMail(oAddresses, EMAIL_FROMTextBox.Text, "Testmail from EmailProfilerConfig", oBody, oAddedWhen, oAttachments, False)
|
|
|
|
Dim oMessageSent = _MailSender.SendMail(oAddresses, EMAIL_FROMTextBox.Text, "Testmail from EmailProfilerConfig", oBody, oAddedWhen, oAttachments, False)
|
|
|
|
Cursor = Cursors.Default
|
|
|
|
Cursor = Cursors.Default
|
|
|
|
|
|
|
|
|
|
|
|
If oMessageSent = True Then
|
|
|
|
If oMessageSent = True Then
|
|
|
|
MsgBox("Email has been send successfully.", MsgBoxStyle.Information)
|
|
|
|
MsgBox("Email has been send successfully.", MsgBoxStyle.Information)
|
|
|
|
Else
|
|
|
|
Else
|
|
|
|
MsgBox("Could not send the testmail. Please check the log.", MsgBoxStyle.Exclamation)
|
|
|
|
MsgBox("Could not send the testmail. Please check the log.", MsgBoxStyle.Exclamation)
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
'NEW END
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'If _limilab.NewSMTPEmail(txtTestmail.Text, "Testmail", "This is the body (text will be replaced within profile)", EMAIL_FROMTextBox.Text, EMAIL_SMTPTextBox.Text, PORTTextBox.Text,
|
|
|
|
|
|
|
|
' EMAIL_USERTextBox.Text, PWPlain, AUTH_TYPEComboBox.Text, "frmMain-Test", "", "", True) = True Then
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
' MsgBox("Email has been send successfully.", MsgBoxStyle.Information)
|
|
|
|
|
|
|
|
'Else
|
|
|
|
|
|
|
|
' MsgBox("Could not send the testmail. Please check the log.", MsgBoxStyle.Exclamation)
|
|
|
|
|
|
|
|
'End If
|
|
|
|
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btntestImap.Click
|
|
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btntestImap.Click
|
|
|
|
ConfigManager.Save()
|
|
|
|
ConfigManager.Save()
|
|
|
|
Dim oSQL = $"SELECT * FROM TBDD_EMAIL_ACCOUNT WHERE GUID = {EMAILIDTextBox.Text}"
|
|
|
|
Dim oSQL = $"SELECT * FROM TBDD_EMAIL_ACCOUNT (NOLOCK) WHERE GUID = {EMAILIDTextBox.Text}"
|
|
|
|
Dim oDT As DataTable = _database.GetDatatable(oSQL)
|
|
|
|
Dim oDT As DataTable = _database.GetDatatable(oSQL)
|
|
|
|
If Not IsNothing(oDT) Then
|
|
|
|
If Not IsNothing(oDT) Then
|
|
|
|
|
|
|
|
|
|
|
|
|