📄 sendbulkemail.vb
字号:
'
Imports System.Threading
Imports System.Web.Mail
Imports AspNetSecurity = System.Web.Security
Namespace NetShopForge.Services.Mail
''' -----------------------------------------------------------------------------
''' <summary>
''' The SendBulkEMail Class is a helper class tht manages the sending of Email
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [cnurse] 9/13/2004 Updated to reflect design changes for Help, 508 support
''' and localisation
''' </history>
''' -----------------------------------------------------------------------------
Public Class SendBulkEmail
Public Recipients As Generic.IDictionary(Of String, String)
Public Priority As MailPriority
Public Subject As String
Public BodyFormat As MailFormat
Public Body As String
Public Attachment As String
Public SendMethod As String
Public Administrator As String
Public Heading As String
Public Sub New()
End Sub
Public Sub New(ByVal recipients As List(Of String), ByVal priority As String, ByVal format As String, ByVal portalAlias As String)
Me.Recipients = recipients
Select Case priority
Case "1"
Me.Priority = MailPriority.High
Case "2"
Me.Priority = MailPriority.Normal
Case "3"
Me.Priority = MailPriority.Low
End Select
If format = "BASIC" Then
Me.BodyFormat = MailFormat.Text
Else
Me.BodyFormat = MailFormat.Html
' Add Base Href for any images inserted in to the email.
Me.Body = "<Base Href='" & portalAlias & "'>"
End If
End Sub
'Public Sub Send()
' Try
' Dim endDelimit As String
' 'Use either vbCrLF or <br><br> depending on BodyFormat.
' If BodyFormat = MailFormat.Html Then
' endDelimit = "<br>"
' Else
' endDelimit = vbCrLf
' End If
' Dim strConfirmation As String
' strConfirmation = "Bulk Email Operation Started: " & Now().ToString & endDelimit & endDelimit
' ' send to recipients
' Dim strBody As String
' Dim intRecipients As Integer = 0
' Dim intMessages As Integer = 0
' Dim strDistributionList As String = ""
' Dim objRecipient As String
' Select Case SendMethod
' Case "TO"
' For Each objRecipient In Recipients
' If objRecipient.Text <> "" Then
' intRecipients += 1
' strBody = Heading & objRecipient.Value & "," & endDelimit & endDelimit & Body
' Mail.SendMail(Administrator, objRecipient.Text, "", "", Priority, Subject, BodyFormat, System.Text.Encoding.UTF8, strBody, Attachment)
' intMessages += 1
' End If
' Next
' Case "BCC"
' For Each objRecipient In Recipients
' If objRecipient.Text <> "" Then
' intRecipients += 1
' strDistributionList += "; " & objRecipient.Text
' End If
' Next
' intMessages = 1
' strBody = Body
' Mail.SendMail(Administrator, "", "", strDistributionList, Priority, Subject, BodyFormat, System.Text.Encoding.UTF8, strBody, Attachment)
' End Select
' ' send confirmation
' strConfirmation += "Email Recipients: " & intRecipients.ToString() & endDelimit
' strConfirmation += "Email Messages: " & intMessages.ToString() & endDelimit & endDelimit
' strConfirmation += "Bulk Email Operation Completed: " & Now().ToString & endDelimit
' Mail.SendMail(Administrator, Administrator, "", "", Priority, "Bulk Email Confirmation", BodyFormat, System.Text.Encoding.UTF8, strConfirmation, "")
' Catch exc As Exception
' ' send mail failure
' System.Diagnostics.Debug.Write(exc.Message)
' End Try
'End Sub
End Class
End Namespace
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -