Digital Data - Marlon Schreiber fd30d75e9f MS HTTPS, Log,
2018-12-12 11:42:55 +01:00

59 lines
2.6 KiB
VB.net

Imports DigitalData.Modules.Logging
Public Class clsJob_Work
Dim Logger As Logger
Private MyLogger As LogConfig
Private _mail As clsEmail
Public Sub New(MyLoggerConf As LogConfig, _email As clsEmail)
Logger = MyLoggerConf.GetLogger()
MyLogger = MyLoggerConf
_mail = _email
End Sub
Public Function New_Mail_with_attachment(Email_receipiants As String, Email_subject As String, Email_Body As String, EmailProfil As Integer, DTTBDD_EMAIL As DataTable, Attachment_Filename As String)
Try
Logger.Debug("Email_Empfänger: " & Email_receipiants)
Logger.Debug("Email_Betreff: " & Email_subject)
Logger.Debug("Email_Body: " & Email_Body)
Logger.Debug("EMAIL_PROFIL: " & EmailProfil)
Dim oMAILFROM As String = ""
Dim oMAILSMTP As String = ""
Dim oMAIL_USER As String = ""
Dim oMAIL_USER_PW As String = ""
Dim oMAIL_AUTH_TYPE As String = "SSL"
Dim oMAIL_PORT As String = "25"
If IsNothing(DTTBDD_EMAIL) And DTTBDD_EMAIL.Rows.Count >= 1 Then
Logger.Warn("DT_TBDD_EMAIL is nothing or contains no rows")
Return False
End If
For Each emailrow As DataRow In clsCURRENT.DT_TBDD_EMAIL.Rows
If emailrow.Item("GUID") = CInt(EmailProfil) Then
oMAILFROM = emailrow.Item("EMAIL_FROM")
oMAILSMTP = emailrow.Item("EMAIL_SMTP")
oMAIL_USER = emailrow.Item("EMAIL_USER")
oMAIL_USER_PW = emailrow.Item("EMAIL_PW")
oMAIL_AUTH_TYPE = emailrow.Item("AUTH_TYPE")
oMAIL_PORT = emailrow.Item("PORT")
End If
Next
Dim owrapper As New clsEncryption("!35452didalog=")
Dim oPWPlain = owrapper.DecryptData(oMAIL_USER_PW)
If Not IsNothing(oPWPlain) Then
oMAIL_USER_PW = oPWPlain
Else
Logger.Warn("PWPlain is Nothing - Could not decrypt passwort 44")
Return False
End If
If _mail.Email_Send_Independentsoft(Email_subject, Email_Body, Email_receipiants, oMAILFROM, oMAILSMTP, oMAIL_PORT, oMAIL_USER, oMAIL_USER_PW, oMAIL_AUTH_TYPE, Attachment_Filename) = True Then
Return True
Else
Logger.Warn("Email_Send_Independentsoft was not successfull!")
Return False
End If
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
End Class