By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,628 Members | 1,880 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,628 IT Pros & Developers. It's quick & easy.

Simple mailto snippet?

P: n/a
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.


Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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.

Jul 23 '05 #2

P: n/a

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

Jul 23 '05 #3

P: n/a
Yogi_Bear_79 wrote:
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="so*****@hotmail.com">To<br>
<input type="text" name="cc"
value="so*********@hotmail.com">cc<br>
<input type="text" name="subject"
value="Test of mail to">Subject<br>
<b>Body</b><br>
<textarea name="body" value="so*****@hotmail.com"
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>

--
Rob
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.