I have a PHP form that works like a charm when only one email address is used - however when I went to add an extra email address for the form to be sent to, separating them with a comma like was stated when I did a google search for the issue, I now get an error page when submitting. Adding that second email address was the only thing I changed from the version that worked just fine. The page is testing here: http://jennilynn.net/IMT/satmathenroll.html enrollmath.php: <?php $EmailFrom = $_POST['Email']; $EmailTo = "jenni@jennilynn.net,jennilynn6@gmail.com"; $Subject = "Someone wants to enroll in SAT Math!"; $SName = Trim(stripslashes($_POST['SName'])); $PName = Trim(stripslashes($_POST['PName'])); $Tel = Trim(stripslashes($_POST['Tel'])); $Email = Trim(stripslashes($_POST['Email'])); $City = Trim(stripslashes($_POST['City'])); $State = Trim(stripslashes($_POST['State'])); $SATYESNO = Trim(stripslashes($_POST['SATYESNO'])); $Score = Trim(stripslashes($_POST['Score'])); $Colleges = Trim(stripslashes($_POST['Colleges'])); // validation $validationOK=true; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } // prepare email body text $Body = ""; $Body .= "Students Name: "; $Body .= $SName; $Body .= "\n"; $Body .= "Parent Name: "; $Body .= $PName; $Body .= "\n"; $Body .= "Tel: "; $Body .= $Tel; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "City: "; $Body .= $City; $Body .= "\n"; $Body .= "State: "; $Body .= $State; $Body .= "\n"; $Body .= "Taken the SAT?: "; $Body .= $SATYESNO; $Body .= "\n"; $Body .= "Score: "; $Body .= $Score; $Body .= "\n"; $Body .= "3 Top Colleges: "; $Body .= $Colleges; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?> Code (markup): and the HTML part: <form method="post" action="enrollmath.php"> <label for="SName" class="enroll">Student's Name:</label> <input type="text" name="SName" id="SName" /><br /> <label for="PName" class="enroll">Parent's Name:</label> <input type="text" name="PName" id="PName" /><br /> <label for="Tel" class="enroll">Phone:</label> <input type="text" name="Tel" id="Tel" /><br /> <label for="Email" class="enroll">Email:</label> <input type="text" name="Email" id="Email" /><br /> <label for="City" class="enroll">City:</label> <input type="text" name="City" id="City" /><br /> <label for="State" class="enroll">State:</label> <input type="text" name="State" id="State" /><br /> <hr /> <br /> <label for="SAT" class="enroll_long">Has student taken the SAT before?</label> <select name="SATYESNO" class="checkboxenroll" id="SATYESNO" name="SATYESNO"> <option value="Yes">Yes</option> <option value="No">No</option> </select> <br /> <br /><br /> <div id="contact-area-enroll-bottom"> <label for="Score" class="enrollbottom">Most recent math score:</label> <input type="text" name="Score" id="Score" width="15px" /><br /> <label for="Colleges" class="enrollcollege">Top 3 universities/colleges<br />student wishes to attend:</label> <input type="text" name="Colleges" id="Colleges" class="colleges" /> <br /><br /> <input type="submit" name="submit" value="Submit" class="submit-button" /> </form> Code (markup): Thanks in advance!
The code isn't very good, but I'm on a cellphone and can't be arsed going through it all, just wanna say you should definitely make sure your form sanitizes input a little better. The error might be as simple as not having a space between , and the next email.
I had tried it with and without a space around the comma, which didn't change the outcome I'm not a PHP expert obviously but I had found that code and it worked without issue until I added that second address in.
Again - providing a solution, even though you find the solution elsewhere, is common practice, simply to help others in the future who might experience the same problems find a solution. If the solution was found to be something else than the PHP script alltogether, for instance the setup of the mail server, or something similar, then say so, so people can check for this if they experience something similar.