msemail2
This commit is contained in:
@@ -131,7 +131,7 @@ Public Class Email
|
||||
End Function
|
||||
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,
|
||||
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
|
||||
Dim oError As Boolean = False
|
||||
Dim oReceipiants As String()
|
||||
@@ -177,25 +177,21 @@ Public Class Email
|
||||
Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString(mymesssage.Body)
|
||||
htmlView.ContentType = New System.Net.Mime.ContentType("text/html")
|
||||
mymesssage.AlternateViews.Add(htmlView)
|
||||
attment = attment.Replace("W:\", "\\windream\objects\")
|
||||
If attment <> String.Empty Then
|
||||
If System.IO.File.Exists(attment) Then
|
||||
_logger.Info("Attachment Path is: {0}", attment)
|
||||
Dim oAttachment As New System.Net.Mail.Attachment(attment)
|
||||
_logger.Debug($"attachmentString [{attachmentString}]")
|
||||
If attachmentString <> "" Then
|
||||
_logger.Info($"Attachment Path is: {attachmentString}")
|
||||
Dim oAttachment As New System.Net.Mail.Attachment(attachmentString)
|
||||
|
||||
'If attment.ToLower.EndsWith("pdf") Then
|
||||
' oAttachment.ContentType = New Independentsoft.Email.Mime.ContentType("application", "pdf")
|
||||
'ElseIf attment.ToLower.EndsWith("jpg") Then
|
||||
' oAttachment.ContentType = New Independentsoft.Email.Mime.ContentType("application", "jpg")
|
||||
'ElseIf attment.ToLower.EndsWith("docx") Then
|
||||
' oAttachment.ContentType = New Independentsoft.Email.Mime.ContentType("application", "MS-word")
|
||||
'End If
|
||||
mymesssage.Attachments.Add(oAttachment)
|
||||
Else
|
||||
_logger.Warn($"Attachment {attment.ToString} is not existing - Mail won't be send!")
|
||||
oError = True
|
||||
|
||||
End If
|
||||
'If attment.ToLower.EndsWith("pdf") Then
|
||||
' oAttachment.ContentType = New Independentsoft.Email.Mime.ContentType("application", "pdf")
|
||||
'ElseIf attment.ToLower.EndsWith("jpg") Then
|
||||
' oAttachment.ContentType = New Independentsoft.Email.Mime.ContentType("application", "jpg")
|
||||
'ElseIf attment.ToLower.EndsWith("docx") Then
|
||||
' oAttachment.ContentType = New Independentsoft.Email.Mime.ContentType("application", "MS-word")
|
||||
'End If
|
||||
mymesssage.Attachments.Add(oAttachment)
|
||||
Else
|
||||
_logger.Debug("No Attachment.")
|
||||
End If
|
||||
_logger.Debug($"mailfrom [{mailfrom}]")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user