Frank
Frank

Reputation:

How to send mail with a Subject using a Mailto URL?

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?

Upvotes: 25

Views: 99158

Answers (5)

VENKATESH KARNI
VENKATESH KARNI

Reputation: 66

Try this code to set subject, body, cc, bcc

<p>HI <a href = "mailto:[email protected]?subject=Hello&body= Have a good day!&cc=add here cc email&bcc=add here bcc email">venky!</a></p>

Upvotes: 0

lc.
lc.

Reputation: 116458

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

    [email protected]
    
  • Add entry in the "Blind Copy To" or "BCC" field

    [email protected]
    
  • 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:[email protected]?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:[email protected]?subject=This+Is+My+Product">

Upvotes: 5

Fuji727
Fuji727

Reputation: 141

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:[email protected]?subject=This+Is+My+Product">

or

<a href="mailto:[email protected]?subject=This%20Is%20My%20Product">

Upvotes: 11

Stefan Mai
Stefan Mai

Reputation: 23939

<a href="mailto:[email protected]?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.

Upvotes: 1

Related Questions