This commit is contained in:
Digital Data - Marlon Schreiber
2019-03-22 15:48:41 +01:00
parent fb92a0fd1c
commit 676e9d40b8
17 changed files with 547 additions and 184 deletions

View File

@@ -228,6 +228,9 @@ Partial Class frmMain
Me.LOG_ERRORS_ONLYCheckBox = New System.Windows.Forms.CheckBox()
Me.LAST_TICKTextBox = New System.Windows.Forms.TextBox()
Me.TabPage4 = New System.Windows.Forms.TabPage()
Me.Button6 = New System.Windows.Forms.Button()
Me.txtAttachment = New System.Windows.Forms.TextBox()
Me.Label6 = New System.Windows.Forms.Label()
Me.Button5 = New System.Windows.Forms.Button()
Me.AUTH_TYPEComboBox = New System.Windows.Forms.ComboBox()
Me.TBDD_EMAIL_ACCOUNTBindingSource = New System.Windows.Forms.BindingSource(Me.components)
@@ -2360,6 +2363,9 @@ Partial Class frmMain
'
'TabPage4
'
Me.TabPage4.Controls.Add(Me.Button6)
Me.TabPage4.Controls.Add(Me.txtAttachment)
Me.TabPage4.Controls.Add(Me.Label6)
Me.TabPage4.Controls.Add(Me.Button5)
Me.TabPage4.Controls.Add(AUTH_TYPELabel)
Me.TabPage4.Controls.Add(Me.AUTH_TYPEComboBox)
@@ -2401,14 +2407,40 @@ Partial Class frmMain
Me.TabPage4.Text = "Email"
Me.TabPage4.UseVisualStyleBackColor = True
'
'Button6
'
Me.Button6.Location = New System.Drawing.Point(872, 347)
Me.Button6.Name = "Button6"
Me.Button6.Size = New System.Drawing.Size(30, 23)
Me.Button6.TabIndex = 38
Me.Button6.Text = "..."
Me.Button6.UseVisualStyleBackColor = True
'
'txtAttachment
'
Me.txtAttachment.Location = New System.Drawing.Point(395, 347)
Me.txtAttachment.Name = "txtAttachment"
Me.txtAttachment.Size = New System.Drawing.Size(471, 22)
Me.txtAttachment.TabIndex = 37
'
'Label6
'
Me.Label6.AutoSize = True
Me.Label6.Location = New System.Drawing.Point(392, 331)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(91, 13)
Me.Label6.TabIndex = 36
Me.Label6.Text = "Test Attachment:"
'
'Button5
'
Me.Button5.Location = New System.Drawing.Point(294, 381)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(75, 23)
Me.Button5.Size = New System.Drawing.Size(95, 23)
Me.Button5.TabIndex = 35
Me.Button5.Text = "Button5"
Me.Button5.Text = "Test Email(RAW)"
Me.Button5.UseVisualStyleBackColor = True
Me.Button5.Visible = False
'
'AUTH_TYPEComboBox
'
@@ -3034,4 +3066,7 @@ Partial Class frmMain
Friend WithEvents EncryptToolStripMenuItem As ToolStripMenuItem
Friend WithEvents Button5 As Button
Friend WithEvents TextBox1 As TextBox
Friend WithEvents txtAttachment As TextBox
Friend WithEvents Label6 As Label
Friend WithEvents Button6 As Button
End Class

View File

@@ -260,7 +260,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAI
DAAAAk1TRnQBSQFMAgEBAwEAAVABAwFQAQMBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
DAAAAk1TRnQBSQFMAgEBAwEAAXgBAwF4AQMBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@@ -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