If I have a single form, is it possible for the visitor to choose where it is sent? As in, selecting a member of Staff from a dropdown menu which subsequently sends that form to that e-mail address? And is it possible to have the form sent to multiple addresses at once?
Multiple Mail Form
Collapse
X
-
Re: Multiple Mail Form
Yes, but you would have to add additional security features. As it is now the email address it is sent to is hard coded. If you change that to being a field submitted by the user (which is what it would be if you make it a drop down menu), you will have to check that submitted data to make sure multiple email address weren't entered. It could very easily be used to send spam if you don't do that check.
And sending to multiple address is very simple, you just separate the emails by a comma.
PHP Code:$mailto = "email1@domain.com,email2@domain.com,email3@domain.com";
For sending the email to a specified address, create the dropdown menu, and set the "name" attribute for the dropdown menu to something like "email_to", and for each selection of the menu set the "value" to the email address
And then in the script set
PHP Code:$mailto = $_POST['email_to'];
PHP Code:function valid_email($check)
{
return preg_match("/^[^\s()<>@,;:\"\/\[\]?=]+@\w[\w-]*(\.\w[\w-]*)*\.[a-z]{2,}$/i",$check);
}
if(!valid_email($mailto))
die("Invalid email address");
I hope that helps
Register/Login Script
Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script
-
Comment