O Auth aus Oberfäche
This commit is contained in:
@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
|
|||||||
<Assembly: AssemblyCompany("Digital Data")>
|
<Assembly: AssemblyCompany("Digital Data")>
|
||||||
<Assembly: AssemblyProduct("EmailProfiler Config")>
|
<Assembly: AssemblyProduct("EmailProfiler Config")>
|
||||||
<Assembly: AssemblyCopyright("Copyright © 2026")>
|
<Assembly: AssemblyCopyright("Copyright © 2026")>
|
||||||
<Assembly: AssemblyTrademark("3.6.0.0")>
|
<Assembly: AssemblyTrademark("3.7.0.0")>
|
||||||
|
|
||||||
<Assembly: ComVisible(False)>
|
<Assembly: ComVisible(False)>
|
||||||
|
|
||||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
|||||||
' übernehmen, indem Sie "*" eingeben:
|
' übernehmen, indem Sie "*" eingeben:
|
||||||
' <Assembly: AssemblyVersion("1.0.*")>
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("3.6.0.0")>
|
<Assembly: AssemblyVersion("3.7.0.0")>
|
||||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||||
|
|||||||
@@ -770,53 +770,60 @@ 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
|
||||||
oDefault = False
|
oDefault = False
|
||||||
End If
|
End If
|
||||||
Dim oOptions As New Mail.MailSession.MailSessionOptions() With {
|
Dim oOptions As New Mail.MailSession.MailSessionOptions() With {
|
||||||
.EnableTls1_1 = CheckBoxEnableTls1_1.Checked,
|
.EnableTls1_1 = CheckBoxEnableTls1_1.Checked,
|
||||||
.EnableTls1_2 = CheckBoxEnableTls1_2.Checked,
|
.EnableTls1_2 = CheckBoxEnableTls1_2.Checked,
|
||||||
.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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user