Preloaded mailto

  • Thread starter Thread starter RICHARD BROMBERG
  • Start date Start date
R

RICHARD BROMBERG

I am creating a website that includes using a mailto .
Is is possible to preload some text into the body of the message ?

Thanks
 
Dear Richard,
Try this - if you look at the code, you will see a ? after the mailto:
and then subject=
that's the subject. &body= starts the body. Look at the code
carefully, you cant use spaces, you must use the replacement code given
(ASCII) - I'm sure you can figure it out - good luck.

<A
href="mailto:?subject=Great%20New%20Web%20Site&amp;body=%0AHere%27s%20a%20great%20new%20web%20site%20you%20might%20be%20interested%20in%20%3A%0A%0Ahttp%3A%2F%2Fwww%2Eexample%2Ecom%2F%0A">Recommend

Our Site</A>
 
RICHARD said:
I am creating a website that includes using a mailto .
Is is possible to preload some text into the body of the message ?

Thanks

function mailThisMsg() {
var subj = "Mail from Me"
var text = "Some text in the body"

var content = new Array()
content[0] = "mailto:"
content[1] = (e-mail address removed)
content[2] = "?subject="
content[3] = subj
content[4] = "&body="
content[5] = text
content = content.join("")
window.location = content
}

HTML
<input type="button" value="Send Email" onClick="mailThisMsg();">

Add your text into the variable text. Or you can split it up if you want
text = "Some text in the body"
+ "Some more text in the body"
+ "Some more text in the body"
+ "Some more text in the body"
 
Thanks for the quick response.

I wrote a small text program http://dickbrom.com/PRELOADEDMAILTO2.htm but
it seems to have a problem.

Here is a JPG image showing the exact source code.
http://dickbrom.com/source.jpg

Any ideas

Thanks
Trevor L. said:
RICHARD said:
I am creating a website that includes using a mailto .
Is is possible to preload some text into the body of the message ?

Thanks

function mailThisMsg() {
var subj = "Mail from Me"
var text = "Some text in the body"

var content = new Array()
content[0] = "mailto:"
content[1] = (e-mail address removed)
content[2] = "?subject="
content[3] = subj
content[4] = "&body="
content[5] = text
content = content.join("")
window.location = content
}

HTML
<input type="button" value="Send Email" onClick="mailThisMsg();">

Add your text into the variable text. Or you can split it up if you want
text = "Some text in the body"
+ "Some more text in the body"
+ "Some more text in the body"
+ "Some more text in the body"
 
Richard,

As far as I can tell, the problem appears to be that content[1] is being
read as a variable, so the solution is to set the address into a variable:

function mailThisMsg() {
var recpt = "(e-mail address removed)"
var subj = "Mail from Me"
var text = "Some text in the body"

var content = new Array()
content[0] = "mailto:"
content[1] = recpt
content[2] = "?subject="
content[3] = subj
content[4] = "&body="
content[5] = text
content = content.join("")
window.location = content
}

I apologise. What I posted was incorrect.
 
Trevor

That was exactly the right fix. Works fine now.

Thank you

Dick Bromberg

Trevor L. said:
Richard,

As far as I can tell, the problem appears to be that content[1] is being
read as a variable, so the solution is to set the address into a variable:

function mailThisMsg() {
var recpt = "(e-mail address removed)"
var subj = "Mail from Me"
var text = "Some text in the body"

var content = new Array()
content[0] = "mailto:"
content[1] = recpt
content[2] = "?subject="
content[3] = subj
content[4] = "&body="
content[5] = text
content = content.join("")
window.location = content
}

I apologise. What I posted was incorrect.

--
Cheers,
Trevor L.
Website: http://tandcl.homemail.com.au


RICHARD said:
Thanks for the quick response.

I wrote a small text program http://dickbrom.com/PRELOADEDMAILTO2.htm
but it seems to have a
problem.
Here is a JPG image showing the exact source code.
http://dickbrom.com/source.jpg

Any ideas

Thanks
 
Back
Top