Solved

Insert a subject and body to a mailto tag

Posted on 2002-06-28
14
1,183 Views
Last Modified: 2012-05-04
I know how to enter a mailto tag. but I would like the e-mail windoe to open with the subject field complete and some body.

Can I do this and how?
0
Comment
Question by:LOBO
  • 4
  • 4
  • 3
  • +1
14 Comments
 
LVL 23

Expert Comment

by:Zeffer
ID: 7120951
you can use the following JavaScript trick to put in either a subject,
OR some body content. I have not been able to get it to do
both.
you add code in the URL panel at the end of the address.
 
eg..for the subject...

on (release) {
   getURL("mailto:lobo@somewhere.com?subject=your subject","_blank");
}

for the body..

on (release){
   getURL("mailto:lobl@somewhere.com?body=here is some text","_blank");
}


Z
0
 

Author Comment

by:LOBO
ID: 7121170
I can't get the mailto tag to work on a pc... at all!
0
 

Author Comment

by:LOBO
ID: 7121198
I can't get the mailto tag to work on a pc... at all!
0
 
LVL 23

Expert Comment

by:Zeffer
ID: 7121543
I'm using pc and it works..
how were you using the mailto tag in the first place..
you said you knew how to do that..

are you copying one of the above examples exactly?
post the code you are trying.

Z
0
 
LVL 19

Expert Comment

by:webwoman
ID: 7122563
Mailto is totally and completely dependent on how the client is set up. Sometimes it works, sometimes it doesn't, and you have no way to control it.

If you want to handle form input, do it on the server. There you DO control it and the user doesn't.
0
 

Author Comment

by:LOBO
ID: 7126157
I've got two machines running windows 2000 with IIS installed, and the mailto tag doesn't work on either of them. However, if i try the mailto tag on a windows 98 or 95 machine... it works!

Is there a setting or something that i can change in either windows 2000 or IIS that can change this?
0
 
LVL 23

Expert Comment

by:Zeffer
ID: 7126243
sorry..don't know.
bet there is though!

Z
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 19

Expert Comment

by:webwoman
ID: 7126566
No. There's NOTHING you can do. It's totally and completely dependent on the client -- what browser, what mail client they use. You have NO WAY to influence or change that.

That's why mailto is flakey -- no control, no consistency, no hope of getting any.
0
 

Expert Comment

by:rappajava
ID: 7330143
You can construct a mailto: tag using any of the standard header terms.

? separates the email address from the name/value pair
= separates the name and value; n=v

<mailto:expert@huh.com>
<mailto:expert@huh.com?subject=howdy>
<mailto:expert@huh.com?body=Type%20stuff%20here>
<mailto:expert@somewhere.com?cc=bubba@gump.com>

You can string expressions together with the & delimiter:

<mailto:expert@huh.com?subject=howdy&cc=bubba@gump.com&body=Type%20stuff%20here>

You can also use + to denote a space:

<mailto:expert@huh.com?body=Type+stuff+here>
0
 
LVL 19

Expert Comment

by:webwoman
ID: 7330198
That doesn't work with all browsers, and mailto is notoriously flakey and doesn't work AT ALL if there's no mail client installed.
0
 

Author Comment

by:LOBO
ID: 7332237
if i use rappajava's answer, out of 10 clients what would be the average that this would not work with, and what kind of error would they receive.
0
 

Expert Comment

by:rappajava
ID: 7333629
Ok, lets back up.  You asked how to use a mailto tag with multiple parameters.

If you put in something like <a href="mailto:expert@huh.com?subject=howdy&cc=bubba@gump.com&body=Type%20stuff%20here> as the tag it will work....PROVIDING YOU HAVE THE REST OF THE PARTS, like a mail client.  I totally agree with Webwoman on how flakey that is, but that wasn't the question and Webwoman brings up a different debate.  Your question was how to DO it, and I'm sticking with that story.

What should happen is any half-way configured computer will launch the default mail client and populate the information. Just as any number of "standard" behaviors for browsers don't always work, this is no exception. Personally, I've had very good results with it but fully expect that someone can get it to fail fairly easily. If there is no mail client that volunteers to launch and run, the browser may do nothing or it may declare a "not found" error or some other unexpected thing.

The best way around this is to use a CGI or SSI extender that accepts form data and creates an email.  I use NetCloak on my servers.  If you want to write 20 more miles of code, use ASP.  If you don't have a server, you can set up a free mail responder from http://www.response-o-matic.com.
0
 
LVL 23

Expert Comment

by:Zeffer
ID: 7333737
An excellent and complete response..in my opinion:)

Z
0
 

Accepted Solution

by:
rappajava earned 50 total points
ID: 7333931
Thanks, Zeffer.

In the mean time, I just tried it on six different scenarios.  

1. A Windoze 98 with IE 5 (which launched Outlook Express)
2. A classic Mac with Netscape (which launched itself)
3. The same classic Mac with IE5 (which launched Netscape Mail... don't tell Bill)
4. An OS X Mac G4 with IE 5.2.2 (which launched the Apple Mail client)
5. A Windoze 2000 with IE 5.5 (launched Outlook Express)
6. A Windoze NT 4 with IE 2 for NT which had no mail client anywhere.  It's a server.  An error popped up saying there was no mail client configured to use internet shortcuts.

All of them that launched populated the fields correctly.  The Outlook client on the 2000 machine wasn't configured, so it demanded some attention first but it worked.  I have no idea what AOL would do, other than charge you $24.95 to do it.

So that's the scoop.  It seems that any machine a consumer might touch works.  Any machine designed to be a server might not.  I'll confirm that on the IIS machine at work tomorrow.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now