2009-06-09 12 views
1

我從我的ASP.net頁面發送消息給一個電子郵件帳戶,該消息正確發送並且可以在Thunderbird或任何瀏覽器中查看我用的其他電子郵件客戶端從.net發送的消息System.Net.Mail在BlackJack II上不可見Windows Mobile

但我無法查看我的Windows Mobile 6.1(二十一點二)設備的消息文本,我已經設置

msg.BodyEncoding = System.Text.Encoding.Unicode; 

玩耍了
msg.BodyEncoding = System.Text.Encoding.UTF8; 

甚至

msg.BodyEncoding = System.Text.Encoding.ASCII; 

但這些工作和消息正文都沒有在設備上顯示。

代碼發送消息低於

凡身體是一個ASP.net TextBox控件

try 
    { 
    MailMessage msg = new MailMessage("[email protected]", "[email protected]"); 
    msg.Subject = "[TestProduct - TestPage.aspx]"; 
    msg.Body = Body.Text; 
    msg.IsBodyHtml = true; 
    SmtpClient sc = new SmtpClient("localhost"); 
    sc.Send(msg); 
    txtMsg.Text = "Thank you for contacting TestCompany Inc someone will contact you promptly."; 
    } 
    catch 
    { 
    txtMsg.Text = "Unable to send your message at this time, Please try again later. Sorry for inconvineance."; 
    } 

當IsBodyHtml =假,我不設置編碼這些標題,我收到

From - Tue Jun 09 11:48:23 2009 
Received: from chronos ([127.0.0.1]) by chronos.lunarpages.com with MailEnable ESMTP; Tue, 09 Jun 2009 11:45:09 -0700 
MIME-Version: 1.0 
From: Removed 
To: Removed 
Date: 9 Jun 2009 11:45:09 -0700 
Subject: [TestProduct - TestPage.aspx] 
Content-Type: text/plain; charset=us-ascii 
Content-Transfer-Encoding: quoted-printable 
Return-Path: <Removed> 

test this message 

仍然我無法在設備中看到它。

+0

你確定你的信息BOD y(Body.Text)是HTML嗎? – SLaks 2009-06-09 18:15:07

+0

我試過用IsBodyHtml = false,實際上body不是html和簡單文本 – AppDeveloper 2009-06-09 18:17:54

+0

移動設備上發生了什麼? 您可以看到該消息,但它沒有任何文字? – SLaks 2009-06-09 18:23:37

回答

0

檢查以確定二十一點設置爲接收HTML電子郵件。

+0

我的設備設置爲接收HTML郵件 – AppDeveloper 2009-06-09 18:19:23

0

我覺得它與您的移動設備的問題。你嘗試過其他設備嗎?你正在使用哪種瀏覽器?檢查您的瀏覽器設置。

0

BlackJack上的郵件客戶端可能無法顯示HTML郵件。大多數電子郵件程序都會生成它們發送的消息的純文本版本。但是,System.Net.Mail.SmtpClient不會自動執行此操作。

可以通過像這樣

string plainTextVersion = //... 
msg.AlternateViews.Add(AlternateView.CreateFromString(plainTextVersion, null, "text/plain"); 
msg.AlternateViews.Add(AlternateView.CreateFromString(Body.Text, null, "text/html"); 

EDIT創建與消息的純文本版本的AlternateView對象:如果設備能夠顯示HTML消息,這將不能解決問題。

0

你能查看移動設備上的原始消息嗎?如果是這樣,我會把它發佈給這裏的一些專家。這將有助於查看設備試圖呈現的MIME部分。

1

就像一個測試,我想嘗試:

  • 完全不
  • 組主題爲「富」(即文本字符串)
  • 設定的主體設置IsBodyHtml爲「欄」 (即文本字符串)

應舉個最簡單的郵件 - 如果它的工作原理,在一個時間改變一件事情,直到它打破了:)