Is it possible to set the subject/content of email when I use mailto:?
转载于:https://stackoverflow.com/questions/4782068/can-i-set-subject-content-of-email-using-mailto
Is it possible to set the subject/content of email when I use mailto:?
转载于:https://stackoverflow.com/questions/4782068/can-i-set-subject-content-of-email-using-mailto
Yes, look all tips and tricks with mailto: http://www.angelfire.com/dc/html-webmaster/mailto.htm
mailto subject example:
<a href="mailto:no-one@snai1mai1.com?subject=free chocolate">example</a>
mailto with content:
<a href="mailto:?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>
As alluded to in the comments, both subject
and body
must be escaped properly. Use encodeURIComponent(subject)
on each, rather than hand-coding for specific cases (like %0A
for line breaks).