×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

编码也做了吗?

本文发表在 rolia.net 枫下论坛这样一段文字(body)

Now, what if you want to do this directly from JavaScript? You may not want a URL, but instead may want to pop up a mail window if a user clicks a button (like the Test URL button above or the Mail Window Test button below). In that case, you could use code similar to that shown in Listing 1.

编码后应该是这样escape(body):

Now%2C%20what%20if%20you%20want%20to%20do%20this%20directly%20from%20JavaScript%3F%20You%20may%20not%20want%20a%20URL%2C%20but%20instead%20may%20want%20to%20pop%20up%20a%20mail%20window%20if%20a%20user%20clicks%20a%20button%20%28like%20the%20Test%20URL%20button%20above%20or%20the%20Mail%20Window%20Test%20button%20below%29.%20In%20that%20case%2C%20you%20could%20use%20code%20similar%20to%20that%20shown%20in%20Listing%201.%20%0D%0A%0D%0A

或者你把下面的东西直接输入到IE的地址栏里运行(把email地址改一下)

mailto:test@com.com?Subject=Test&Body=Now%2C%20what%20if%20you%20want%20to%20do%20this%20directly%20from%20JavaScript%3F%20You%20may%20not%20want%20a%20URL%2C%20but%20instead%20may%20want%20to%20pop%20up%20a%20mail%20window%20if%20a%20user%20clicks%20a%20button%20%28like%20the%20Test%20URL%20button%20above%20or%20the%20Mail%20Window%20Test%20button%20below%29.%20In%20that%20case%2C%20you%20could%20use%20code%20similar%20to%20that%20shown%20in%20Listing%201.%20%0D%0A%0D%0A更多精彩文章及讨论,请光临枫下论坛 rolia.net
Report

Replies, comments and Discussions:

  • 工作学习 / 专业技术讨论 / Ask for similar function as "mailto"
    I am try to submit a form using mailto. I take all the form textfield's value as the body message of mailto. Unfortunately, I found there is a body length for mailto command, something like not more than 100 characters. That's too bad. By the way, I am using HTML and Javascript to encode it. Can anyone give me some good idea?
    • urgent. Please help me!!!
      • 没有什么100字符的限制吧,在javascript里用escape(body)里应该就可以了
        • 我还是不太清楚,请详细说明好吗?谢谢!
          • 看看这个:
            http://redvip.homelinux.net/varios/mailto.html
            • Thank you. I tried it. But still doesn't work.
              • 编码也做了吗?
                本文发表在 rolia.net 枫下论坛这样一段文字(body)

                Now, what if you want to do this directly from JavaScript? You may not want a URL, but instead may want to pop up a mail window if a user clicks a button (like the Test URL button above or the Mail Window Test button below). In that case, you could use code similar to that shown in Listing 1.

                编码后应该是这样escape(body):

                Now%2C%20what%20if%20you%20want%20to%20do%20this%20directly%20from%20JavaScript%3F%20You%20may%20not%20want%20a%20URL%2C%20but%20instead%20may%20want%20to%20pop%20up%20a%20mail%20window%20if%20a%20user%20clicks%20a%20button%20%28like%20the%20Test%20URL%20button%20above%20or%20the%20Mail%20Window%20Test%20button%20below%29.%20In%20that%20case%2C%20you%20could%20use%20code%20similar%20to%20that%20shown%20in%20Listing%201.%20%0D%0A%0D%0A

                或者你把下面的东西直接输入到IE的地址栏里运行(把email地址改一下)

                mailto:test@com.com?Subject=Test&Body=Now%2C%20what%20if%20you%20want%20to%20do%20this%20directly%20from%20JavaScript%3F%20You%20may%20not%20want%20a%20URL%2C%20but%20instead%20may%20want%20to%20pop%20up%20a%20mail%20window%20if%20a%20user%20clicks%20a%20button%20%28like%20the%20Test%20URL%20button%20above%20or%20the%20Mail%20Window%20Test%20button%20below%29.%20In%20that%20case%2C%20you%20could%20use%20code%20similar%20to%20that%20shown%20in%20Listing%201.%20%0D%0A%0D%0A更多精彩文章及讨论,请光临枫下论坛 rolia.net
            • I tried this sample. the same problem, I can input only about 200 characters in the body.
              • the exact body length is 239 characters
                • 那可能就是你的邮件系统的限制(lotus notes本身的缺陷或者人为的配置),换一个试试吧。我都是用的outlook express做的。
                  • I tried it in hotmail. It's Okay. How can I change Lotus Notes configurations?
                    • 对不起,我一点儿也不懂lotus notes,所以也不知道怎么配置。其实如果你能用ASP,JSP的话问题就容易解决多了
                      • I use HTML and JavaScript. I don't know how to use ASP. :((((( Anyway, thank you very much.
    • 啥是mailto啊?mailto: 只是一个html的tag吧
      如果要发信,windows平台IIS server 可以用CDO 或者CDONTS ,unix 平台用sendmail.
      • "mailto:emailaddress" is a protocol. like http://, ed2k://. it need to registered by browser or html enabled application. when click the URL is directed to propriate application, like IE, email client or edonkey...
        • since it is protocol, it works not only for windows, but also for Linux, which I am using. For other OS, the same thing.
          • 你说的对,mailto确实是一个protocol,
            不过这个东西并不能发信,只是启动缺省发信软件,所以我一直觉得和一个tag没什么区别。
            • 你说得对,我只是自动启动Lotus
    • 没有发现100字符的限制啊?
      <html>
      <form action="mailto:test@tets.com">
      subject:<input type=edit name=subject><br>
      body:<br>
      <textarea name=body>
      </textarea>
      <input type=submit value="send">
      </form>
      </html>
      做了个测试页,我在body里放了300多,没有问题。估计是encode 除了问题吧。
      • 在我的程序里有16个textfield. 所有textfield的值和相应的Label都作为mail得body message. 另外,缺省的邮件系统是Lotus,请问你的邮件系统是什么?
      • 我用mailto:test@test.com&subject=test?body="+textfield1.value+textfield2.value+......
        • 试过mailto:test@test.com—body=长字符串,也没问题。mail client 是 outlook express. 建议你把textfield1.value+textfield2.value...用一个简单长字符串替换试试。
        • 另外似乎用mailto:test@test.com&subject=test&body=好一些。不用?号
          • Thank you. I think it is probably because of Lotus Notes system. I tried again today. The same problem.
            my code is:
            location = "mailto:test@test.com?subject="+Subject+"&body="+L1+L2+L3+L4+L5+L6+L7+"&cc="+CC;

            L1=document.myform.T1.value;
            L2=document.myform.T2.value;

            and so on.

            <input type="text" name="T1">

            I am going to die if I can't resolve it!!!