Actually, it'd be easier to just add multiple recipients instead of multiple sends. Just replace $to with the code below. If you want to add a third person, just copy everything from the ' after
name@example.com to the last semi-colon and paste it where the last semi-colon is.
PHP Code:
// multiple recipients
$to = 'name@example.com' . ', '; // note the comma
$to .= 'user@example.com';
The drop down is another story. If you want to just pick from a list of single email addresses, do this.
PHP Code:
$to = trim($_POST['to']);
HTML Code:
<tr valign="top">
<td>Select Recipient</td>
<td><select name="to">
<option name="to" value="user@example.com">User</option>
<option name="to" value="name@example.com">Name</option>
<option name="to" value="person@example.com">Person</option>
</select></td>
</tr><tr valign="top">
<td>Your email address </td>
<td><input name="email" type="text" size="32"></td>
</tr>
And then comes the fun one. If you want to send to multiple people in multiple groups.
PHP Code:
if ($formto == 'admin') {
$to = 'admin@example.com' . ', ';
$to .= 'webmaster@example.com';
}
if ($formto == 'mods') {
$to = 'moderator@example.com' . ', ';
$to .= 'leader@example.com';
}
HTML Code:
<tr valign="top">
<td>Select Recipient</td>
<td><select name="formto">
<option name="formto" value="admin">User</option>
<option name="formto" value="mods">Name</option>
</select></td>
</tr><tr valign="top">
<td>Your email address </td>
<td><input name="email" type="text" size="32"></td>
</tr>
For each group that you want to send to, make an option for them in the form itself, and an if statement in the php. I think PHP variables are case sensitive (can't rememeber, I keep them the same anyway), so if you put admin in one, put admin in the other, not ADMIN or something.
As a bit of a warning, I put this all together from the available tutorial, info from the Zend website on mail(), and some of my old contact scripts and experience. I haven't tested it yet, but I'll moniter this thread if there's any problems.