Solved

mailto: extendability

Posted on 2000-04-20
15
242 Views
Last Modified: 2010-04-09
I'm trying to figure out how (or if) I can get a mailto: link to automatically insert some starter text into the mail message. Has anyone come across a way to do this?

Thanks
0
Comment
Question by:winkle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
15 Comments
 
LVL 3

Expert Comment

by:fibdev
ID: 2736565
You can use javascript to do this ...  This will fill in the subject, but I don't know about filling in the message body.

<SCRIPT language="JavaScript">
<!--
/* Mailto enhancement */

function e_friend()
{
var e_add= 'you@youraddy.com';
var subj= 'your subject here';
var e_body= 'enter some text here';
if ((subj==" ") || (subj==null))
 subj="Hi!";
window.location="mailto:"+e_add+"?subject="+subj;}
//-->
</SCRIPT>

Use this as the link:
<A HREF="javascript:e_friend2()">Email</A>


This may work too ...
<a href="mailto:you@youraddy.com?subject='your subject'">mail me!</a>
0
 
LVL 3

Expert Comment

by:fibdev
ID: 2736578
Nevermind that last one, I had to fix something on it ...

Revised:

<SCRIPT language="JavaScript">
<!--
/* Mailto enhancement */

function e_friend()
{
var e_add= 'you@youraddy.com';
var subj= 'your subject here';
if ((subj==" ") || (subj==null))
 subj="Hi!";
window.location="mailto:"+e_add+"?subject="+subj;}
//-->
</SCRIPT>

Use this as the link:
<A HREF="javascript:e_friend()">Email</A>
0
 
LVL 1

Expert Comment

by:lambda
ID: 2737003
<a href="mailto:me@mydomain.com?subject=hello&body=what is this">Mail me</a>

£.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:CJ_S
ID: 2737152
Or use the CDONTS object from ASP (that is IF you can use ASP)
0
 

Expert Comment

by:Tarraq
ID: 2737184
Hey!

lambda's answer is the easiest, but please note, that this won't work with all browsers / mail clients.

- Tarraq
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2737327
lease note that you won't be able to have a subject with spaces.
0
 
LVL 3

Accepted Solution

by:
fibdev earned 50 total points
ID: 2738769
See if this one lets you include message text ...

<SCRIPT language="JavaScript">
<!--
/* Mailto enhancement - Place this in the head of the document */

function e_friend()
{
var e_add= 'you@youraddy.com';
var subj= 'your subject here';
var e_body= 'message text goes here ...';
window.location="mailto:"+e_add+"?subject="+subj+"&body= "+e_body;}
//-->
</SCRIPT>

Use this as the link:
<A HREF="javascript:e_friend()">Email</A>

This will produce the results you want.  Just reject it if you want to try another way, but the only way I think your going to have spaces in the message subject and body is to use some sort of scripting.

:)
0
 
LVL 3

Expert Comment

by:fibdev
ID: 2738777
There is a space before the message body ... try replacing this line:

window.location="mailto:"+e_add+"?subject="+subj+"&body= "+e_body;}


with this one ...

window.location="mailto:"+e_add+"?subject="+subj+"&body="+e_body;}


:)
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2739576
You might wanna use the replace function to replace the body text etc with %20 (which is supposed to be a space)
0
 
LVL 3

Expert Comment

by:fibdev
ID: 2739759
CJ,

I tryed it like this ...

<SCRIPT language="JavaScript">
<!--
/* Mailto enhancement - Place this in the head of the document */

function e_friend()
{
var e_add= 'you@youraddy.com';
var subj= 'your subject here';
var e_body= 'message text goes here ...';
window.location="mailto:"+e_add+"?subject="+subj+"&body="+e_body;}
//-->
</SCRIPT>


It works good.  As of yesterday I'm using it on my site for people to unsubscribe to my mailing list.  It's funny, but this isn't the first thing I've coded becuase the idea was spawned here at the ee.  Many thanks to the Experts-Exchange.
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2739764
quote:
This will produce the results you want.  Just reject it if you want to try another way, but the only way I think your going to have spaces in the message subject and body is to use some sort of scripting.

quote:
It works good.  As of yesterday I'm using it on my site for people to unsubscribe to my mailing list.  It's funny, but this isn't the first thing I've coded becuase the idea was spawned here at the ee.  Many thanks to the Experts-Exchange.

And you tested it with spaces and stuff too?????.......uhm......whichn of your comment is true?

0
 
LVL 3

Expert Comment

by:fibdev
ID: 2739775
uh ...

I don't know what your asking but you can go to my site and click the link to be removed from the mailing list at the bottom of the products page

http://fibdev.com/products.htm#produpmail

Just click where it says "Click here" in the blue box.
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2739782
Just checked it, you're right.
0
 
LVL 3

Expert Comment

by:fibdev
ID: 2747543
waiting ...  :)
0
 

Author Comment

by:winkle
ID: 2757833
Thanks. Both methods worked very well. (spaces included)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

738 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