cheap web hosting

mailto in HTML

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.
xarzu's picture

They have: 6 posts

Joined: May 2007

I am trying to use the tag "mailto" in an HTML file to prompt the user to email me. Specifically, I want to have the subject and the body of the email message already filled in when the user sends me the email.

So far, I have managed to have a hyperlink where the body is already filled in:
<a href="mailto::username@gmail.com?body='test'">this works</a>I have also managed to have a hyperlink where the subject line is already filled in:

<a href="mailto:usernamegmail.com?subject='the subject'">this works too</a>

But I have yet to figure out how do combine the two:

<a href="mailto::username@gmail.com?subject='the subject and
the body'?body='test'">help</a>

Does anyone know how to do this?

teammatt3's picture
Moderator

He has: 1,856 posts

Joined: Sep 2003

mailto:email@example.com?body=bodymessage&subject=subjectline

The & solves your problem. Smiling

JeevesBond's picture
Moderator

He has: 3,523 posts

Joined: Jun 2002

<a href="mailto:username@gmail.com?subject='the subject and the body'&amp;body='test'">wibble</a>
mailto isn't that great though, it's better to use a contact form in PHP. That's a lot more difficult of course. Biggest problem with mailto is that you'll problem get spam.

a Padded Cell our articles site!

He has: 319 posts

Joined: May 2007

... JeevesBond is right. There is also the difficulty people face when using a computer at work, the library, or any computer not their own -- the email client may well be de-activated, so clicking the link will likely give an error of some sort.

Unless you are into server-side form processing, I suggest you take a look at the Wufoo form builder. Should take you about an hour, tops, to build a contact form you can put on your own page, or have Wufoo host it.

The form is coded nicely, and has anti-spam measures built in.

Cordially, David
--
"Old web developers don't die, they degrade gracefully..."