Click to See Complete Forum and Search --> : JavaScript Send Mail - Multi Function Help


theflyingminst
02-12-2008, 11:25 AM
Hi I am using a JavaScript code that works with an .asp file (view asp code here: http://www.brainjar.com/common/viewsource.asp?source=/asp/formmail/formmail.asp).

JavaScript code:

<html>
<head>

<script type="text/javascript">
//<![CDATA[
function processForm(f) {
f._recipients.value = f.Email.value; f._recipients2.value;
}
//]]>
</script>

</head>

<form action="formmail.asp" method="post">
<input name="_recipients" type="hidden" value="" />
<input name="_recipients2" type="hidden" value="myemail@myemail.com" />
<input name="_replyToField" type="hidden" value="Email" />
<input name="_requiredFields" type="hidden" value="Name,Email" />
<input name="_fieldOrder" type="hidden" value="info1,info2" />
<input name="_subject" type="hidden" value="Your confirmation Email.." />
<input type="hidden" name="info1" value="Info...">
<input type="hidden" name="info2" value="Info 2...">
<input name="_redirect" type="hidden" value="post-enter.htm" />
<input name="Name" type="text" size="28" />
<input name="Email" type="text" size="28" />
<input class="button" type="submit" value="Submit" onclick="return processForm(this.form)" />&nbsp;
<input class="button" type="reset" value="Clear" /></th>

</body>
</html>


The .asp code is set up to send an email and the JavaScript sends it to the address inputted in the email field (The form has hidden data that they will use for access purposes on my website).

My problem is calling a multiple function so that it will ALSO send the email to myself (myemail@myemail.com) for security purposes.

The function works fine like this:

function processForm(f) {
f._recipients.value = f.Email.value;
}

I tried doing something like this:

function processForm(f) {
f._recipients.value = f.Email.value; f._recipients2.value;
}

and that doesn’t cut it, I’m assuming it’s probably a syntax issue?..

Any help would be greatly appreciated.

Thanks!

gil davis
02-12-2008, 12:02 PM
function processForm(f) {
f._recipients.value = f.Email.value; f._recipients2.value;
}
Usually mailers will take multiple recipients separated by either a comma or semi-colon. You could try:

function processForm(f) {
f._recipients.value = f.Email.value + ";" + f._recipients2.value;
}
Or, you could figure out the syntax for BCC and add a hidden field with your email address there.

theflyingminst
02-12-2008, 12:53 PM
Hey thanks for the quick response!

That code actually didn't work for either, but I looked into the CC idea and tried this:

<input name="_replyToField" type="hidden" value="Email?cc=myemail@myemail.com" />

It didn't work but I probably don't have the code right yet.

gil davis
02-12-2008, 07:17 PM
I looked at the code you posted, and it looks for a comma-delimited list in _recipients, so what I posted should work if you replace the ";" with ",".

function processForm(f) {
f._recipients.value = f.Email.value + "," + f._recipients2.value;
}
Was there some documentation along with the code that tells you how to use it?

theflyingminst
02-12-2008, 07:40 PM
Gil, you are the man. It works! Thank you so much!!