【问题标题】:How to Send email with High Importance in asp.net VB如何在 asp.net VB 中发送具有高重要性的电子邮件
【发布时间】:2015-02-23 23:30:54
【问题描述】:

如何设置下面的代码以在主题行中生成具有高优先级的电子邮件?感谢您的指导。

Private Sub SendEmail(ByVal pharmEmail As String, ByVal backupEmail As String)
    Dim smtpClient As New System.Net.Mail.SmtpClient()
    Dim message As New System.Net.Mail.MailMessage()

    Try
        Dim fromAddress As New System.Net.Mail.MailAddress(WebConfigurationManager.AppSettings("EmailFromAddr"), WebConfigurationManager.AppSettings("EmailFromName"))
        message.From = fromAddress
        message.To.Add(pharmEmail)
        message.Subject = WebConfigurationManager.AppSettings("EmailSubject")
        If (WebConfigurationManager.AppSettings("backupEnabled") = True) Then
            message.CC.Add(backupEmail)
        End If
        message.IsBodyHtml = True
        Dim orderURL As New HyperLink
        orderURL.Text = "here"
        orderURL.NavigateUrl = "http://" & WebConfigurationManager.AppSettings("ServerName") & "/User/ReviewOrder.aspx?orderID=" & webOrderID
        message.Body = "An order was created using the account of " + Profile.FirstName.ToString() + " " + Profile.LastName.ToString() + ". " + WebConfigurationManager.AppSettings("EmailBody") + "<a href='" + orderURL.NavigateUrl + "'>here.</a>"
        'message.Body = WebConfigurationManager.AppSettings("EmailBody") & " " & orderURL.
        smtpClient.Send(message)
    Catch ex As Exception
        ErrorHandler.WriteError(ex.ToString)
        Throw ex
    End Try

【问题讨论】:

标签: asp.net vb.net sendmail


【解决方案1】:

我相信您可以在MailMessage 上设置Priority 属性。详情请见MSDN

【讨论】:

  • 前两个选项返回一个错误,指出 message.Priority = MailPriority.High 已过时,但以下操作没有任何问题,message.Priority = Net.Mail.MailPriority.High. 感谢您的指导。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-07-16
  • 2011-03-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多