I need to make a Mailto link
to my website which is suppose to contain either the product name or the product page URL in the subject section
. How can I do it?
Exp: When you get an email through eBay
about a product you are selling or buying, you automatically know what product that email is about by seeing the product name in the subject section.
How can i do this?
Asked
Active
Viewed 9.7k times
24

Sandip Armal Patil
- 6,241
- 21
- 93
- 160
-
Frank, that subject line really could have been better. – John Saunders Jul 07 '09 at 18:22
5 Answers
60
<a href="mailto:example@foo.com?subject=hello world">Email Me!</a>
Internet Archive:
- Set up an HTML mailto form without a back-end script
- HTML Mailto Attribute and Tips
- HTML Mailto Tips and Tricks
- Mailto Syntax
Related Stackoverflow Questions:
-
1@sur007 Thank you for pointing this out. I was able to point them to a cached copy in the wayback machine. Thanks! – Sampson Sep 18 '13 at 18:49
-
11
I've run into problems with this before when I didn't url encode the value, so I would suggest (using lc's example):
<a href="mailto:foo@bar.com?subject=This+Is+My+Product">
or
<a href="mailto:foo@bar.com?subject=This%20Is%20My%20Product">

Fuji727
- 141
- 1
- 3
5
This page [Link Dead] outlines the syntax of mailto URIs:
Address message to multiple recipients
, (comma separating e-mail addresses)
Add entry in the "Subject" field
subject=Subject Field Text
Add entry in the "Copy To" or "CC" field
cc=id@internet.node
Add entry in the "Blind Copy To" or "BCC" field
bcc=id@internet.node
Add entry in the "Body" field
body=Your message here Within the body use "%0A" for a new line, use "%0A%0A" for a new line preceded by a blank line (paragraph),
What you are looking for is:
<a href="mailto:foo@bar.com?subject=This Is My Product">
Note, it's probably a good idea to URL encode the spaces with either a +
or a %20
:
<a href="mailto:foo@bar.com?subject=This+Is+My+Product">

lc.
- 113,939
- 20
- 158
- 187
1
<a href="mailto:stefan.mai@example.com?subject=YourSubjectHere">Try This</a>
If you want something more advanced, you're going to have to code it from scratch (or use someone else's script). Try looking into PHP, ASP.NET, Ruby on Rails, etc.

Stefan Mai
- 23,367
- 6
- 55
- 61
0
Try this code to set subject, body, cc, bcc
<p>HI <a href = "mailto:venkateshkarni1996@gmail.com?subject=Hello&body= Have a good day!&cc=add here cc email&bcc=add here bcc email">venky!</a></p>

VENKATESH KARNI
- 56
- 6