0

How do I set the code below to generate email with high priority in the subject line? Thank you for any guidance.

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
runDOSrun
  • 10,359
  • 7
  • 47
  • 57
Loic
  • 123
  • 1
  • 18

1 Answers1

3

I believe you can set the Priority property on the MailMessage. See MSDN for more details.

Lloyd
  • 29,197
  • 4
  • 84
  • 98
  • 1
    The first two option were returning an error saying that `message.Priority = MailPriority.High` was obsolete but the following did work without any issue, `message.Priority = Net.Mail.MailPriority.High.` Thank you for your guidance. – Loic Feb 23 '15 at 15:18