Email

B

Brian Wilson

Anyone know how I can add a "?Subject" line to this?

<head>
<script>
var sdomain='brianjenny.net';
var email='webmaster';
var myaddress=(''+email+'@'+sdomain+'');
</script>
<title>Email</title>
</head>

<body>
<script>
document.write("<a href=mailto:"+myaddress+" class=textlink
style=color:black;>"+myaddress+"</a>div>");
</script>
</body>
 
C

Cycloneous Echevarria

Brian, copy / paste the code below.

Orlando, aka, Cycloneous


<html>
<head>
<script>
var sdomain='brianjenny.net';
var email='webmaster';
var myaddress= email+'@'+sdomain+'';
</script>
<title>Email</title>
</head>

<body>
<script>
document.write("<div><a href='mailto:"+myaddress+ "?subject=Hello
World!'" + " class=textlink style=color:black;>"+myaddress+"</a><div>");
</script>
</body>
</html>
 
B

Brian Wilson

Yes, it does work---- Copy the text below: Make sure the document.write is
all on one line.

<html>
<head>
<script>
var sdomain='brianjenny.net';
var email='webmaster';
var myaddress= email+'@'+sdomain+'';
</script>
</head>

<body>
<script>document.write("<font size='+1', font face='Times New Roman'>" +
"<a href='mailto:"+myaddress+"?subject=Web Mail'" + " class=textlink
style=color:black;>"+myaddress+"</a>");</script>
</body>
</html>
 
B

Brian Wilson

Yes, it works --- Copy the text below making sure that the document.write
line is all on one line.

<head>
<script>
var sdomain='brianjenny.net';
var email='webmaster';
var myaddress= email+'@'+sdomain+'';
</script>
</head>

<body>
<script>document.write("<font size='+1', font face='Times New Roman'>" +
"<a href='mailto:"+myaddress+"?subject=Web Mail'" + " class=textlink
style=color:black;>"+myaddress+"</a>");</script>
</body>
 
M

Michael Winter

Yes, it works --- Copy the text below making sure that the document.write
line is all on one line.

You're missing the point. The mailto: scheme itself is unreliable.
Although a lot of browsers and mail clients will support it and the
extension that allows the specification of the subject and other headers,
the support is not universal. Furthermore, intelligent spam bots could
easily get your e-mail address, so the tactic is useless. Finally, using a
mail client exposes the sender's e-mail address, which they may not want
to do.

Use a form mail script. There are many free ones available. Google for
"free form mail", Response-o-Matic, or Bravenet for many options.

This should read

<script type="text/javascript">

The type attribute is required.
<script>document.write("<font size='+1', font face='Times New Roman'>" +

The FONT element is deprecated, has been for many years, and should no
longer be used. Use style sheets. Setting specific font sizes and type
faces is also generally frowned-upon. That can be debated in
comp.infosystems.www.authoring.stylesheets, though.

[snip]

Mike
 
R

Richard Cornford

Brian said:
Yes, it works --- Copy the text below making sure that the
document.write line is all on one line.
<snip>

No it does not work (unless you use a very restricted criteria for
"works"). The first problem is the mailto: protocol, which pre-supposed
that the browser is configured to employ a default e-mail program (or
can act as one itself) and that that e-mail program is itself
appropriately configured. On an Intranet that can be expected to be the
case, but on the Internet the existence and use of a web browser implies
nothing about e-mail software, its availability, configuration or
functionality.

The next problem is attempting to append a subject to the message. I was
asked to do this some years ago on an Intranet that used Lotus notes as
an e-mail client. It worked with the basic mailto URL, opening the
appropriate part of Lotus Notes with the e-mail address in the "To"
line, but attempting to add anything else (subject, body etc.) promptly
stopped it from working at all. (A server-based alternative was
eventually used instead)

So while Outlook might allow all sots of possibilities in mailto URLs
beyond the basic recipient address, using any of them is actually likely
to render the result non-functional with other e-mail programs.

With such a list of problems stacking up against mailto URLs in use on
the Internet, it is now generally accepted that they are terminally
broken and should be abandoned in favour of server-side alternatives,
which are available as remote services so local server-script support is
not even required in order to avoid the mailto problems.

Richard.
 
C

Chris

Jeez I've not long come back to this mailing list after abt 2 years out and
having read about 4 of your posts, you seem to provide no useful
information, nor do you do anything except utter your anal retentive
gibberish

if it isn't constructive - it has to be a 12 year old posting it, after he's
just had his lunch money stolen by the "big" kids in the year below him....

Also working fine should be....

<script type="text/javascript">
var a="me",b="@my.com",c="?subject=email"
function pullAddress(){
return a + b + c;
}
</script>

<a href="" onMouseover="this.href='mailto:' + pullAddress()">Mail me...</a>

using a mouseover will actually stop address spyders from finding your email
address, what a lot of people tend to forget is that all spyders wait until
the page is loaded and read body.innerHTML which will surprise surprise
include your full email address
they don't however trip event handlers like onmouseover

using onmouseover your email link also acts as a normal link as users will
see the true email address in the status bar

- sorry ppl that got a little bit long - have been on the caffeine again,
something about this list, i always drink way too much coffee....
 
R

Richard Cornford

Chris said:
Jeez I've not long come back to this mailing list after abt 2 years

This group's FAQ recommended the normal Usenet practice of not top
posting replies over full quotes even 2 years ago.

Also working fine should be....

<script type="text/javascript">
var a="me",b="@my.com",c="?subject=email"
function pullAddress(){
return a + b + c;
}
</script>

<a href="" onMouseover="this.href='mailto:' + pullAddress()">Mail
me...</a>

using a mouseover will actually stop address spyders from finding
your email address,
<snip>

What happens for people who use keyboard navigation?

But the primary problems is - mailto - so any method of creating a
mailto URL fails to solve the real problem.

Richard.
 
R

Randy Webb

Chris said:
Jeez I've not long come back to this mailing list after abt 2 years out and
having read about 4 of your posts, you seem to provide no useful
information, nor do you do anything except utter your anal retentive
gibberish

If me saying mailto is unreliable is gibberish, then 90% of the internet
is gibberish because it is not an opinion I hold alone. So, let me
explain. My default IE install (IE 6) has NO email program associated
with it. When I click on a mailto:, I get asked to install OE which I
wont. Its got more security flaws than I care to think about. But my
email address (one of them anyway) is through comcast.net and is
web-based. There's no way for you to open that page, fill in the TO: and
Subject lines via a link. Its impossible. The second set of email
addresses I have are AOL email addresses. I refuse to let IE kick me
into AOL to send an Email. The reason I won't is because I have
different names for different purposes, I will choose what email address
I want to use for what mails, not a website.

If you want to send email, from a website, and it be reliable, use a
form, submit the data to the server, and then send it from the server.

if it isn't constructive - it has to be a 12 year old posting it, after he's
just had his lunch money stolen by the "big" kids in the year below him....

Also working fine should be....

<script type="text/javascript">
var a="me",b="@my.com",c="?subject=email"
function pullAddress(){
return a + b + c;
}
</script>

<a href="" onMouseover="this.href='mailto:' + pullAddress()">Mail me...</a>

using a mouseover will actually stop address spyders from finding your email
address, what a lot of people tend to forget is that all spyders wait until
the page is loaded and read body.innerHTML which will surprise surprise
include your full email address
they don't however trip event handlers like onmouseover

using onmouseover your email link also acts as a normal link as users will
see the true email address in the status bar

A slight improvement would be to document.write the link so that people
with script disabled won't see the link, since it won't "work" as it
should without scripting enabled, even though the href property you are
trying to invoke is unreliable.
 
D

Dr John Stockton

JRS: In article <_hAmc.34149$_41.2900675@attbi_s02>, seen in
news:comp.lang.javascript said:
Yes, it works --- Copy the text below making sure that the document.write
line is all on one line.

No need for that, if the code is decently formatted :
<body>
<script>document.write("<font size='+1', font face='Times New Roman'>" +
"<a href='mailto:"+myaddress+"?subject=Web Mail'" + " class=textlink
style=color:black;>"+myaddress+"</a>");</script>
</body>


<body>
<script>
document.write("<font size='+1', font face='Times New Roman'>",
"<a href='mailto:", myaddress, "?subject=Web Mail'",
" class=textlink style=color:black;>", myaddress, "</a>");
</script>
</body>

I've not compared the speeds of
document.write(a + b)
document.write(a, b)
but the latter looks easier.
 
K

kaeli

Brian, copy / paste the code below.

That code works great for IE configured to use Outlook. So, for intranet
applications where everyone has IE configured to use Outlook, you're all
set.

However, if anyone uses any other combo, all bets are off.
I myself use Outlook as my mail client at work, but have NO *default*
mail client at home. Therefore, it wouldn't work at all for me at home.

Good try, though.
http://www.ipwebdesign.net/kaelisSpace/useful_mailto.html

--
 
C

Cycloneous Echevarria

It will also work for Netscape/Mozilla browser as well. You simply need
to have those clients as the default email client.

Orlando, aka, Cycloneous
 
K

kaeli

It will also work for Netscape/Mozilla browser as well. You simply need
to have those clients as the default email client.

Orlando, aka, Cycloneous

Exactly. ;)

--
 
R

Randy Webb

Dr John Stockton wrote:

I've not compared the speeds of
document.write(a + b)
document.write(a, b)
but the latter looks easier.

a = "some text";
b = " some more text<br />";
var start1 = new Date();
for (i=0;i<1000;i++){
document.write (a+b)
}
var end1 = new Date();
var time1 = end1 - start1;
var start2 = new Date();
for (i=0;i<1000;i++){
document.write (a,b)
}
var end2 = new Date();
var time2 = end2 - start2;

document.write('a+b took ' + time1 + ' milliseconds<br />');
document.write('a,b took ' + time2 + ' milliseconds<br />');


IE6:
a+b took 60 milliseconds
a,b took 50 milliseconds

Mozilla 1.6:
a+b took 390 milliseconds
a,b took 600 milliseconds

Opera 7:
a+b took 160 milliseconds
a,b took 110 milliseconds

Mozilla Firefox:
a+b took 320 milliseconds
a,b took 610 milliseconds
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top