[英]how to send mail automatically using mailto with attachment from outlook using JavaScript and html
[英]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.