簡體   English   中英

使用郵件編碼問題打開 outlook 上的郵件

[英]open the mail on outlook using mailto encode problem

嗨,在我的網頁中,我生成信息並使用 mailto 打開 outlook 上的郵件,以便用戶修改 email。 它工作得很好。 但是,當正文或主題有引起問題的撇號時,我使用 Server.UrlEncode 對字符串進行編碼。 現在,空格顯示“+”,換行顯示“\n”。 如果我不使用 Server.UrlEncode,則不會調用 function。

有我的代碼在 vb.net 中調用 javascript function

Dim strSubject As String = Server.UrlEncode(strName)
Dim strBody As String = Server.UrlEncode("it's your order list:" & "\r\n" & strList)
Dim script As String = "MailtoOrder(''," & "'" & strSubject & "', '" & strBody & "')"
If Not Page.ClientScript.IsStartupScriptRegistered(Me.GetType(), "mail") Then
                Page.ClientScript.RegisterStartupScript(Me.GetType(), "mail", script, True)
End If

有我的 javascript:

function MailtoOrder( to, subject, body) {
   var email='';
   if (to != undefined) {
    email=to;
   }
    email = email + '&subject=' + encodeURIComponent(subject) + '&body=' + encodeURIComponent(body);  

    window.location.href = "mailto:" +   email;
}

我使用 Server.UrlEncode 逃脫了。 我只是將撇號替換為 strSubject 和 strBody 字符串中的轉義字符。 有用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM