Mailto: Guideline and character limitation

六眼飞鱼酱① 提交于 2019-12-12 14:52:36

问题


I'm trying to code an application which will allow users to send emails from outlook using the mailto tag. I know with the mailto, there involves limitation of # of characters that may be passed, as well as encoding.

Does anyone know the exact count of characters I can use, and what guidelines to follow when it comes to encoding special characters? What is counted in the max number of characters you can use? Body and Subject or the whole line including mailto syntax?

For example I will have the following:

<a href='mailto:test@gmail.com?subject=Test Mail&body=Line one.%0D%0ALine two.'>Test Link</a>

Would this be 69 characters??

Forgot to mention, supported browser will be IE6.

Any help would be appreciated.

Thanks


回答1:


As far as I know there is no limit.

The HTML 4 spec says nothing about a limit

Authors may create links that do not lead to another document but instead cause email to be sent to an email address. When the link is activated, user agents should cause a mail program to open that includes the destination email address in the "To:" field.

To cause email to be sent when a link is activated, specify a MAILTO URL as the value of the href attribute.

http://www.w3.org/TR/WD-html40-970917/struct/links.html#h-13.2.2

However, many sites report a 256 character limit.

You should test to be sure.

You may also find this question and answers illuminating: What is the email subject length limit?




回答2:


Same problem here, so far no good. IE9 has a limit of around 505 characters per href="...", Chrome 21 is better - around 2000 chars.

Update! According to this guys there is a workaround, and it seems to work for me:

 ClientScript.RegisterStartupScript(this.GetType(), "mailto", 

   "<script type = 'text/javascript'>parent.location='" + longMailtoText + 

   "'</script>") ; 

This will launch the script and open MailClient window as soon as client gets the response. LongMailToText should follow all standard rules, except for length - so far i was able to send over 2000 chars through it.



来源:https://stackoverflow.com/questions/7459327/mailto-guideline-and-character-limitation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!