Hello!
Currently I have a form where the user can submit emails in a comma separated format to the $row in database $contacts. How can I set this up correctly so the user can email their contacts? As of right now the script emails everybody but just not in the correct email format. Thank You!
<?php
$formMessage = "";
$senderName = "";
$senderEmail = "";
$senderMessage = "";
if (isset($_POST['cusername']))
{
// Gather the posted form variables into local PHP variables
$senderName = $_POST['cusername'];
$senderEmail = $_POST['cemail'];
$senderMessage = $_POST['msg'];
// Make sure certain vars are present or else we do not send email yet
if (!$senderName || !$senderEmail ) {
$formMessage = "The form is incomplete, please fill in all fields.";
} else { // Here is the section in which the email actually gets sent
// Run any filtering here
$senderName = strip_tags($senderName);
$senderName = stripslashes($senderName);
$senderEmail = strip_tags($senderEmail);
$senderEmail = stripslashes($senderEmail);
$senderMessage = strip_tags($senderMessage);
$senderMessage = stripslashes($senderMessage);
// End Filtering
$to = "$contacts";
$from = "";
$subject = "Prospect For Property";
// Begin Email Message Body
$message = '<html><body>';
';
$message .= "</body></html>";
// Set headers configurations
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
// Mail it now using PHP's mail function
mail($to, $subject, $message, $headers);
$formMessage = "Thanks, your message has been sent.";
$senderName = "";
$senderEmail = "";
$senderMessage = "";
} // close the else condition
} // close if (POST condition
?>