Click to See Complete Forum and Search --> : Select email reciepants


kareem
02-21-2003, 03:30 AM
Hi!
I am designing a web site. on this website, i would like to have a webpage where friends can utilize an email form to type messages and selectet the reciepants of these messages. My friends have different email addresses, yahoo, hotmail, etc. Is there a way to include a list of thier email addresses in my website and next to each email address a checkbox where someone can send a messge to anyone form the list by checking on the checkbox; I would like that multible checkboxes can be done also. This email has to go through my webiste to the selected addresses.

I know that i can do a list with emails which all on my domian such as 333@mydomain.com, jjj@mydomain.com, etc .. but I could not make emails form different domain to work..
Your help is hihgly appreciated.
kareem

AdamGundry
02-21-2003, 11:59 AM
You could use a server-side form-to-mail script to send the e-mails, so that when the user submits the form a script constructs an address list. The script below shows roughly what it should look like - it assumes your form-to-mail script requires the field "recipient" as the recipient list, and that list is comma-seperated.

<form onSubmit="PrepareRecipient">
<input type="hidden" name="recipient" value="">
<input type="check" name="SendToAdam">
<input type="check" name="SendToFriend2">

<script type="text/javascript">
function PrepareRecipient(){
var r ='';

if (SendToAdam.checked){r = 'adam@example.com, ';}
if (SendToFriend2.checked){r = r + 'friend2@example.com, ';}
...

recipient.value = r.substring(r, r.length()-2);
}
</script>


When the form is submitted, the script examines each checkbox in turn (add lines as necessary) and adds to the list if necessary. The last line sets the hidden field's value to the list, minus the final comma.

Hope this helps

Adam

kareem
02-21-2003, 12:13 PM
Thanks Adam!
I do not know where to put this script! Would you please show me more details. If you can make an examople, it would be great! I do not know how to tie a checkbox to a reciepant! Will this enalbe a user to check more than a reciepant?
Kareem