mailto:を使用する際に、メールの件名や内容を設定することはできますか?
はい、mailto: http://www.angelfire.com/dc/html-webmaster/mailto.htm ですべてのヒントとコツをご覧ください。
mailto subjectの例。
<! -- begin snippet: js hide: false console: true babel: false -->
<a href="mailto:[email protected]?subject=free chocolate">example</a>
<! -- スニペットの終了 -->
mailto with content:
。<a href="mailto:[email protected]?subject=look at this website&body=Hi,I found this website and thought you might like it http://www.geocities.com/wowhtml/">tell a friend</a>
<! -- スニペットの終了 -->
コメントにもあるように、subject
と body
の両方を適切にエスケープしなければなりません。特定のケースのために手作業でコーディングするのではなく、それぞれに encodeURIComponent(subject)
を使用してください。
コメントでHoodyが言及しているように、文字列の中に以下のエンコードされたシーケンスを追加することで、改行を追加することができます。
%0D%0A // one line break