msemail2
This commit is contained in:
parent
fcd44e78ff
commit
fb142d4cef
@ -134,10 +134,14 @@ Public Class MyComService
|
|||||||
oAttachment = String.Empty
|
oAttachment = String.Empty
|
||||||
Else
|
Else
|
||||||
oAttachment = oEmail_Row.Item("EMAIL_ATTMT1")
|
oAttachment = oEmail_Row.Item("EMAIL_ATTMT1")
|
||||||
|
|
||||||
|
If File.Exists(oAttachment) = False Then
|
||||||
|
_Logger.Warn($"Email Attachment FileNotFound Exception!")
|
||||||
|
Exit Sub
|
||||||
|
Else
|
||||||
|
_Logger.Info("Email Attachment is: {0}", oAttachment.ToString)
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
_Logger.Debug("Email Attachment is: {0}", oAttachment.ToString)
|
|
||||||
|
|
||||||
Dim link As String = "pmo://" & oJOB_ID & "-" & oEmail_Row.Item("REFERENCE1")
|
Dim link As String = "pmo://" & oJOB_ID & "-" & oEmail_Row.Item("REFERENCE1")
|
||||||
If oBody.Contains("[%PMOLINK_GER]") Then
|
If oBody.Contains("[%PMOLINK_GER]") Then
|
||||||
oBody = oBody.Replace("[%PMOLINK_GER]", "<a href=""" & link & """>hier</a>")
|
oBody = oBody.Replace("[%PMOLINK_GER]", "<a href=""" & link & """>hier</a>")
|
||||||
@ -147,9 +151,7 @@ Public Class MyComService
|
|||||||
oBody = oBody.Replace("[%PMOLINK_US]", "<a href=""" & link & """>here</a>")
|
oBody = oBody.Replace("[%PMOLINK_US]", "<a href=""" & link & """>here</a>")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If _Email.NewEmail(oEmailTo, oSubject, oBody, oMailFrom, oMailSMTP, oMailport, oMailUser, oMailPW, oAuthType, "DDEDMI_ComService", oAttachment.ToString) = True Then
|
||||||
|
|
||||||
If _Email.NewEmail(oEmailTo, oSubject, oBody, oMailFrom, oMailSMTP, oMailport, oMailUser, oMailPW, oAuthType, "DDEDMI_ComService", oAttachment) = True Then
|
|
||||||
Dim upd = "UPDATE TBEDM_EMAIL_QUEUE SET EMAIL_SENT = CURRENT_TIMESTAMP WHERE GUID = " & oGUID
|
Dim upd = "UPDATE TBEDM_EMAIL_QUEUE SET EMAIL_SENT = CURRENT_TIMESTAMP WHERE GUID = " & oGUID
|
||||||
_firebird.ExecuteNonQuery(upd)
|
_firebird.ExecuteNonQuery(upd)
|
||||||
End If
|
End If
|
||||||
|
|||||||
@ -131,7 +131,7 @@ Public Class Email
|
|||||||
End Function
|
End Function
|
||||||
Public Function NewEmail(mailto As String, mailSubject As String, mailBody As String,
|
Public Function NewEmail(mailto As String, mailSubject As String, mailBody As String,
|
||||||
mailfrom As String, mailsmtp As String, mailport As Integer, mailUser As String, mailPW As String,
|
mailfrom As String, mailsmtp As String, mailport As Integer, mailUser As String, mailPW As String,
|
||||||
AUTH_TYPE As String, SENDER_INSTANCE As String, Optional attment As String = "", Optional Test As Boolean = False)
|
AUTH_TYPE As String, SENDER_INSTANCE As String, Optional attachmentString As String = "", Optional Test As Boolean = False)
|
||||||
Try
|
Try
|
||||||
Dim oError As Boolean = False
|
Dim oError As Boolean = False
|
||||||
Dim oReceipiants As String()
|
Dim oReceipiants As String()
|
||||||
@ -177,25 +177,21 @@ Public Class Email
|
|||||||
Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString(mymesssage.Body)
|
Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString(mymesssage.Body)
|
||||||
htmlView.ContentType = New System.Net.Mime.ContentType("text/html")
|
htmlView.ContentType = New System.Net.Mime.ContentType("text/html")
|
||||||
mymesssage.AlternateViews.Add(htmlView)
|
mymesssage.AlternateViews.Add(htmlView)
|
||||||
attment = attment.Replace("W:\", "\\windream\objects\")
|
_logger.Debug($"attachmentString [{attachmentString}]")
|
||||||
If attment <> String.Empty Then
|
If attachmentString <> "" Then
|
||||||
If System.IO.File.Exists(attment) Then
|
_logger.Info($"Attachment Path is: {attachmentString}")
|
||||||
_logger.Info("Attachment Path is: {0}", attment)
|
Dim oAttachment As New System.Net.Mail.Attachment(attachmentString)
|
||||||
Dim oAttachment As New System.Net.Mail.Attachment(attment)
|
|
||||||
|
|
||||||
'If attment.ToLower.EndsWith("pdf") Then
|
'If attment.ToLower.EndsWith("pdf") Then
|
||||||
' oAttachment.ContentType = New Independentsoft.Email.Mime.ContentType("application", "pdf")
|
' oAttachment.ContentType = New Independentsoft.Email.Mime.ContentType("application", "pdf")
|
||||||
'ElseIf attment.ToLower.EndsWith("jpg") Then
|
'ElseIf attment.ToLower.EndsWith("jpg") Then
|
||||||
' oAttachment.ContentType = New Independentsoft.Email.Mime.ContentType("application", "jpg")
|
' oAttachment.ContentType = New Independentsoft.Email.Mime.ContentType("application", "jpg")
|
||||||
'ElseIf attment.ToLower.EndsWith("docx") Then
|
'ElseIf attment.ToLower.EndsWith("docx") Then
|
||||||
' oAttachment.ContentType = New Independentsoft.Email.Mime.ContentType("application", "MS-word")
|
' oAttachment.ContentType = New Independentsoft.Email.Mime.ContentType("application", "MS-word")
|
||||||
'End If
|
'End If
|
||||||
mymesssage.Attachments.Add(oAttachment)
|
mymesssage.Attachments.Add(oAttachment)
|
||||||
Else
|
Else
|
||||||
_logger.Warn($"Attachment {attment.ToString} is not existing - Mail won't be send!")
|
_logger.Debug("No Attachment.")
|
||||||
oError = True
|
|
||||||
|
|
||||||
End If
|
|
||||||
End If
|
End If
|
||||||
_logger.Debug($"mailfrom [{mailfrom}]")
|
_logger.Debug($"mailfrom [{mailfrom}]")
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user