Simple mailto snippet?

Y

Yogi_Bear_79

I am building a stand alone html help system (.chm.) So the usual woes with
mailto are not going to be encountered. Likewise I am ensured all my
intended users have Outlook installed. With that said This is what I want
to do.

I have a simple html form with a an radio button option group, a listmenu, a
text box, and a text area. What I would like to do is have a user fill out
this form, and hit a button that sends the results via outlook. The TO, CC,
and subject fields will be hard coded. I want the option from the list menu
on line one, the radio button on line two, the text box on line three and
the multi-line text area starting on line 4.

I haqve searched the web, and groups all day to no avail. Everything I have
tried simply fails. I even tried breaking this down into a simple one text
box one button, with no good results via javascript. I can get it to work ok
without javscript, but instead of new lines they just overwrite each other.
 
S

Spats30

You need to post the form to a simple form handler that uses a
server-side language like Classic ASP, PHP, or ASP.NET that has a mail
script you can configure. JavaScript does not send emails.

Determine what technology your server uses, then check for a simple
mail script using that technology. Should be easy.
 
Y

Yogi_Bear_79

Sorry, It is designed for a .chm file. SO it must be client side. I realize
that javascript doesn't send e-mail, but it can send via mailto, I need help
with that
 
R

RobG

Yogi_Bear_79 said:
I am building a stand alone html help system (.chm.) So the usual woes with
mailto are not going to be encountered. Likewise I am ensured all my
intended users have Outlook installed. With that said This is what I want
to do.

Given the above caveat, play with the following. Note that I
think Outlook has a 2,000 character limit on what you can send
via mailto. Lotus Notes has a limit of about 200 characters:


<script type="text/javascript">
function prepMail(f) {
var previewHTML =
'<b>To:</b> ' + f.address.value + '<br>'
+ '<b>cc:</b> ' + f.cc.value + '<br>'
+ '<b>Subject:</b> ' + f.subject.value + '<br>'
+ '<b>Body:</b><br> '
+ f.body.value.replace(/\n/g,'<br>') + '<br>'
+ '<a href="mailto:' + f.address.value
+ '?cc=' + f.cc.value
+ '?subject=' + f.subject.value
+ '?body=' + escape(f.body.value)
+ '">Click here to send</a>'
;
document.getElementById('previewPane').innerHTML = previewHTML;
}

</script>

<form action="" name="mailForm">
<input type="text" name="address"
value="(e-mail address removed)">To<br>
<input type="text" name="cc"
value="(e-mail address removed)">cc<br>
<input type="text" name="subject"
value="Test of mail to">Subject<br>
<b>Body</b><br>
<textarea name="body" value="(e-mail address removed)"
rows="20" cols="50">Body</textarea><br>
<input type="button" value="Preview message" onclick="
prepMail(this.form);
">
</form>
<table style="border: 1px solid blue"><tr><td width="50%">
<span id="previewPane"><i>preview will appear here</i><span>
</td></tr></table>
 

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
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top