[網頁設計] 寄信用的mailto 語法解析

各位朋友好!大家在設計網頁時,常常會用到寄信的mailto標籤。
大家或許會好奇問說,那怎麼把預設的標題、內容帶入信件管理程式呢?
很簡單,只要在mailto:xxx後面加上?Subject=標題&Body=內容 即可。
例如下面語法:
mailto:xxx@mailservice?Subject=標題&Body=內容

若是預設的內容(Body)太長,需要換行時,該怎麼辦呢?
其實,mailto後面接的字元,其URL是使用Unicode編碼,我們只要到
http://i-technica.com/whitestuff/urlencodechart.html 查詢後,發現%0d是C Return,%0a是linefeed。
所以得到結論,在mailto的url標籤內,於想要換行的地方,打上 %0d%0a即可。


參考資料

  1. http://www.programmer-club.com.tw/ShowSameTitleN/asp/12963.html
  2. http://i-technica.com/whitestuff/urlencodechart.html
  3. http://taipeier.com/blog/?p=989
This entry was posted in 網頁撰寫. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *