2015-02-23 25 views
0

如何設置下面的代碼以在主題行中生成具有高優先級的電子郵件?感謝您的任何指導。如何在asp.net中發送具有高重要性的電子郵件VB

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 
+1

使用'Priority'屬性。 – Aria 2015-02-23 15:06:06

+0

http://stackoverflow.com/questions/2692919/can-i-mark-an-email-as-high-importance-for-outlook-using-system-net-mail – Caveman 2015-02-23 15:08:13

回答

2

我相信你可以在MailMessage上設置Priority屬性。有關更多詳細信息,請參閱MSDN

+1

前兩個選項返回錯誤說: message.Priority = MailPriority.High'已經過時,但是下面沒有任何問題,'message.Priority = Net.Mail.MailPriority.High.'感謝您的指導。 – Loic 2015-02-23 15:18:40

0

前兩個選項返回一個錯誤,指出message.Priority = MailPriority.High已過時,但以下工作沒有任何問題,message.Priority = Net.Mail.MailPriority.High。感謝您的指導

相關問題