I need a form to send to multiple different receipients based off the user dropdown selection. Here is what I’ve read up on so far… I can get it to say success but I dont recieve the email. Please help!!
Html:
Gmail yahooPHP:
<?php $i = $_POST["sendto"]; switch ($i) { case "gmail": $sendto = "[email protected]"; break; case "recpro": $sendto = "[email protected]"; break; default: $sendto = "[email protected]"; //opional break; } $subject = "test email"; function sanitize( $s ){ $injections = array('/(\n+)/i', '/(\r+)/i', '/(\t+)/i', '/(%0A+)/i', '/(%0D+)/i', '/(%08+)/i', '/(%09+)/i' ); $s = preg_replace( $injections, '', $s ); return $s; } //catch the posted data $first_name = sanitize( $_POST['first_name'] ); $last_name = sanitize( $_POST['last_name'] ); $email = sanitize( $_POST['email'] ); $telephone = sanitize( $_POST['telelphone'] ); $body = $telephone."\n\n"; $body.= $first_name."<$email>"; $headers = "From: $last_name<$email>"; if(mail($send_to, $subject, $body, $headers)): echo "success", $sent_to, $subject, $body, $headers; else: echo "error"; endif; ?>I need it to be header injection safe.