This commit is contained in:
Jonathan Jenne
2023-10-11 15:08:24 +02:00
parent 6add3760bd
commit 36e2d97b20

View File

@@ -912,26 +912,27 @@ Public Class frmMain
End Sub
Private Sub btnsendtestmail_Click(sender As Object, e As EventArgs) Handles btnsendtestmail.Click
' Dim _ss2email As New Email(MyLogger)
Dim llmail As New MailSender(MyLogger)
Dim oSender As New MailSender(MyLogger)
If txtTestmailTo.Text <> String.Empty Then
My.Settings.Save()
Dim wrapper As New clsEncryption("!35452didalog=")
Dim PWPlain = wrapper.DecryptData(EMAIL_PWTextBox.Text)
If llmail.ConnectToServer(EMAIL_SMTPTextBox.Text, PORTTextBox.Text, EMAIL_USERTextBox.Text, PWPlain, AUTH_TYPEComboBox.Text) = True Then
Dim oSession = oSender.Connect(EMAIL_SMTPTextBox.Text, PORTTextBox.Text, EMAIL_USERTextBox.Text, PWPlain, AUTH_TYPEComboBox.Text)
If oSession.Connected = True Then
Dim oSendto As New List(Of String)
oSendto.Add(txtTestmailTo.Text)
Dim oAttMt As New List(Of String)
If txtAttachment.Text <> String.Empty Then
oAttMt.Add(txtAttachment.Text)
End If
If llmail.SendMail(oSendto, EMAIL_FROMTextBox.Text, "Testmail from GUI WMResultHandler", "TEST", Now, oAttMt, 1) = True Then
If oSender.SendMail(oSendto, EMAIL_FROMTextBox.Text, "Testmail from GUI WMResultHandler", "TEST", Now, oAttMt, 1) = True Then
MsgBox("Email has been sent successfully.", MsgBoxStyle.Information)
Else
MsgBox("Could not send the testmail. Please check the log.", MsgBoxStyle.Exclamation)
End If
llmail.DisconnectFromServer()
oSender.Disconnect()
Else
MsgBox("Could not connect to server. Please check the log.", MsgBoxStyle.Exclamation)