// Kyle's awesome mail code // Check for a post function send_email(){ global $message, $subject, $email_addresses, $body; // Check for POST if (!$_POST['message']) return false; // Grab the data $subject = $_POST['subject']; $email_addresses = explode(";", $_POST['to_email']); $body = stripslashes($_POST['message']); // Error checking if (! trim($subject) ){ $message['error'] = "I'm sorry, but you must enter a subject."; return false; } if (!$email_addresses){ $message['error'] = "I'm sorry, but you must enter an email address."; return false; } if (! trim($body) ){ $message['error'] = "I'm sorry, but you must enter a message to send."; return false; } // headers $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; // Send it! foreach($email_addresses as $email_address){ mail($email_address, $subject, $body, $headers); } $message['success'] = "Sent successfully"; $subject = ""; $email_addresses = ""; $body = ""; return true; } send_email(); ?>