Solved

mailto: extendability

Posted on 2000-04-20
15
248 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
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

729 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