MS
This commit is contained in:
@@ -826,17 +826,44 @@ Public Class frmMain
|
||||
Dim PWPlain = wrapper.DecryptData(EMAIL_PWTextBox.Text)
|
||||
Dim sClient = New SmtpClient(EMAIL_SMTPTextBox.Text)
|
||||
Dim mymesssage As New MailMessage
|
||||
sClient.Port = 587
|
||||
sClient.EnableSsl = True
|
||||
sClient.Port = PORTTextBox.Text
|
||||
If AUTH_TYPEComboBox.Text = "SSL" Then
|
||||
sClient.EnableSsl = True
|
||||
Else
|
||||
sClient.EnableSsl = False
|
||||
End If
|
||||
|
||||
sClient.Credentials = New NetworkCredential(EMAIL_USERTextBox.Text, PWPlain)
|
||||
sClient.UseDefaultCredentials = False
|
||||
mymesssage.Body = "Test"
|
||||
mymesssage.From = New MailAddress(EMAIL_FROMTextBox.Text)
|
||||
mymesssage.Subject = "TestSubject"
|
||||
mymesssage.CC.Add(New MailAddress(txtTestmail.Text))
|
||||
sClient.Send(mymesssage)
|
||||
Catch ex As Exception
|
||||
|
||||
mymesssage.Body = $"This is the body (text will be replaced within profile)! <br> mailsmtp: {EMAIL_SMTPTextBox.Text} <br> mailport: {PORTTextBox.Text} <br> mailUser: {EMAIL_USERTextBox.Text} <br> mailPW: XXXX <br> AUTH_TYPE: {AUTH_TYPEComboBox.Text}"
|
||||
Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString(mymesssage.Body)
|
||||
htmlView.ContentType = New System.Net.Mime.ContentType("text/html")
|
||||
mymesssage.AlternateViews.Add(htmlView)
|
||||
|
||||
mymesssage.From = New MailAddress(EMAIL_FROMTextBox.Text)
|
||||
mymesssage.Subject = "TestSubject from RAW Method"
|
||||
mymesssage.To.Add(New MailAddress(txtTestmail.Text))
|
||||
|
||||
If txtAttachment.Text <> String.Empty Then
|
||||
Dim oAttment As String = txtAttachment.Text.Replace("W:\", "\\windream\objects\")
|
||||
|
||||
If System.IO.File.Exists(oAttment) Then
|
||||
Logger.Info($"working on attachment {oAttment}...")
|
||||
Dim oAttachment As New System.Net.Mail.Attachment(oAttment)
|
||||
|
||||
mymesssage.Attachments.Add(oAttachment)
|
||||
Else
|
||||
MsgBox($"Attachment {oAttment.ToString} is not existing - Mail won't be send!")
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
sClient.Send(mymesssage)
|
||||
MsgBox("Email has been sent!")
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
|
||||
|
||||
@@ -851,9 +878,9 @@ Public Class frmMain
|
||||
Dim PWPlain = wrapper.DecryptData(EMAIL_PWTextBox.Text)
|
||||
|
||||
|
||||
If _email.Testmail("Testmail DD Windream-ResultHandler", "This is the body (text will be replaced within profile)", txtTestmail.Text,
|
||||
EMAIL_FROMTextBox.Text, EMAIL_SMTPTextBox.Text, PORTTextBox.Text, EMAIL_USERTextBox.Text, PWPlain, AUTH_TYPEComboBox.Text, "") = True Then
|
||||
MsgBox("Email was send successfully.", MsgBoxStyle.Information)
|
||||
If _email.Email_Send("Testmail from GUI WMResultHandler", "This is the body (text will be replaced within profile)", txtTestmail.Text,
|
||||
EMAIL_FROMTextBox.Text, EMAIL_SMTPTextBox.Text, PORTTextBox.Text, EMAIL_USERTextBox.Text, PWPlain, AUTH_TYPEComboBox.Text, txtAttachment.Text, True) = True Then
|
||||
MsgBox("Email(s) has/have been sent successfully.", MsgBoxStyle.Information)
|
||||
Else
|
||||
MsgBox("Could not send the testmail. Please check the log.", MsgBoxStyle.Exclamation)
|
||||
End If
|
||||
@@ -962,4 +989,18 @@ Public Class frmMain
|
||||
Private Sub LOG_ERRORS_ONLYCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles LOG_ERRORS_ONLYCheckBox.CheckedChanged
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
|
||||
Dim oFD As OpenFileDialog = New OpenFileDialog()
|
||||
|
||||
oFD.Title = "Get a test-attachment:"
|
||||
'oFD.InitialDirectory = "C:\"
|
||||
oFD.Filter = "All files (*.*)|*.*|All files (*.*)|*.*"
|
||||
oFD.FilterIndex = 2
|
||||
oFD.RestoreDirectory = True
|
||||
|
||||
If oFD.ShowDialog() = DialogResult.OK Then
|
||||
txtAttachment.Text = oFD.FileName
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user