Putting a character return in a mailto link
I'm making a simple RSVP form and I'd for users to click a mailto link, 开发者_如何转开发which opens an pre-made email with parts already filled out (first name, etc.) and then send it to RSVP for an event. I know this isn't the best way, but it's the simplest I could come up with.
The only problem is that I can't seem to put character return's in the mailto link, so it looks messy. Any idea how?
My mailto link:
<a href="mailto:blahblahblah@gmail.com?subject=RSVP&body=First name: Last name:">RSVP</a>
Since you are placing your data in a URL, you need to encode such characters using %XX
hex notation, eg:
<a href="mailto:blahblahblah@gmail.com?subject=RSVP&body=First name:%0D%0ALast name:">RSVP</a>
FYI, keep in mind that not all email programs support multiple parameters to the mailto:
protocol, if any at all. You really should look into using a server-side webform instead. Let your users submit feedback to you directly from your website without invoking their local email program at all. Most website hosting services provide such a feature as part of your account, or for a small fee.
精彩评论