mailto in HTML

xarzu's picture

They have: 25 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::[email protected]?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::[email protected]?subject='the subject and
the body'?body='test'">help</a>

Does anyone know how to do this?

teammatt3's picture

He has: 2,102 posts

Joined: Sep 2003

mailto:[email protected]?body=bodymessage&subject=subjectline

The & solves your problem. Smiling

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

<a href="mailto:[email protected]?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: 629 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
--
delete from internet where user_agent="MSIE" and version < 8;

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.