c_lucia10 Posted January 4, 2010 Share Posted January 4, 2010 Hello everyone, i have a promblem with my contact form, i´m not a programmer i´m a web designer so please bare with my language. I created a contact form for a company which has like a firewall on its email accounts. What the contact form does is take the people´s email address and places it on the FROM part of the form, and the server reads it as SPAM email because of the firewall. I was told to create an email acount for example [email protected] and make the form send every input from this email so that the firewall doesn´t filter it. i have no idea how to do this but this is my attempt to fix the problem and it´s not working can someone please advise. Thank you. <? if (isset($_POST["nombre"])){ $para = "myemail@server"; $from = $_POST["email"]; (this is where the form gets the people´s email and makes it appear as spam) $asunto = "Contacto desde el website de Empresa"; $message = "Nombre: ".$_POST["nombre"]."<br>"; if (isset($_POST["empresa"]) && $_POST["empresa"] != "") $message .= "Empresa: ".$_POST["empresa"]."<br>"; if (isset($_POST["ciudad"]) && $_POST["ciudad"] != "") $message .= "Ciudad: ".$_POST["ciudad"]."<br>"; $message .= "Pais: ".$_POST["pais"]."<br>"; $message .= "Teléfono: ".$_POST["tel"]."<br>"; $message .= "Email: ".$_POST["email"]."<br>"; $message .= "Comentarios:<br><br> ".$_POST["comentario"]."<br>"; /* Para enviar correo HTML, puede definir la cabecera Content-type. */ $cabeceras = "MIME-Version: 1.0\r\n"; $cabeceras .= "Content-type: text/html; charset=iso-8859-1\r\n"; $cabeceras .= "From: ".$from."\n"; $exito = mail($para, $asunto, $message, $cabeceras); ?> <script> alert("Sus comentarios han sido enviados con éxito"); </script> <? } ?> ****THIS IS WHAT I CHANGED if (isset($_POST["nombre"])){ $para = "[email protected]"; $from = [email protected]; $asunto = "Contacto desde el website de Empresa"; IT´S NOT WORKING OVIOUSLY, I REALLY NEED HELP THANKS Link to comment https://forums.phpfreaks.com/topic/187128-contact-form-with-filter/ Share on other sites More sharing options...
mrMarcus Posted January 4, 2010 Share Posted January 4, 2010 try adding a fifth parameter to the mail function: <?php $exito = mail($para, $asunto, $message, $cabeceras, "[email protected]"); ?> see how that goes. EDIT: what this will do is change the "from" address to whatever you like. assuming the email address you are adding is seen as "safe" on the mail server, your emails should get through without issue. Link to comment https://forums.phpfreaks.com/topic/187128-contact-form-with-filter/#findComment-988224 Share on other sites More sharing options...
c_lucia10 Posted January 4, 2010 Author Share Posted January 4, 2010 Hello Mr. Marcus, Thanks for your answer, i tryied but it didn´t work but i did something else, and it looks like that´s the way i should go, but i still don´t get the email on the corporate email account. I do see it on yahoo or hotmail but not in the corporate email. this is what i did: <? if (isset($_POST["nombre"])){ $para = "[email protected]"; $from = ""; >> leave it blank $asunto = "Contacto desde el website de Empresa"; $message = "Nombre: ".$_POST["nombre"]."<br>"; if (isset($_POST["empresa"]) && $_POST["empresa"] != "") $message .= "Empresa: ".$_POST["empresa"]."<br>"; if (isset($_POST["ciudad"]) && $_POST["ciudad"] != "") $message .= "Ciudad: ".$_POST["ciudad"]."<br>"; $message .= "Pais: ".$_POST["pais"]."<br>"; $message .= "Teléfono: ".$_POST["tel"]."<br>"; $message .= "Email: ".$_POST["email"]."<br>"; $message .= "Comentarios:<br><br> ".$_POST["comentario"]."<br>"; /* Para enviar correo HTML, puede definir la cabecera Content-type. */ $cabeceras = "MIME-Version: 1.0\r\n"; $cabeceras .= "Content-type: text/html; charset=iso-8859-1\r\n"; $cabeceras .= "From: ".$from."\n" "[email protected]"; $exito = mail($para, $asunto, $message, $cabeceras); ?> <script> alert("Sus comentarios han sido enviados con éxito"); </script> <? } ?> ANY MORE IDEAS??? Link to comment https://forums.phpfreaks.com/topic/187128-contact-form-with-filter/#findComment-988240 Share on other sites More sharing options...
mrMarcus Posted January 4, 2010 Share Posted January 4, 2010 seems your IT department has a pretty tight spam filter there. the idea here is to mask the client's email address with a safe email address that will pass through the spam filter on the mail server. that is where the 5th argument for the mail function came into play. changing the "from" attribute in the headers will ultimately alter the headers, making it impossible to know who actually sent the email. did the company give you a "safe" email address to use that will not be filtered out? Link to comment https://forums.phpfreaks.com/topic/187128-contact-form-with-filter/#findComment-988245 Share on other sites More sharing options...
c_lucia10 Posted January 4, 2010 Author Share Posted January 4, 2010 Mr. Marcus, Yes they gave me a safe email account. With the changes i made, in my yahoo email account it showed me on the message the user´s email address, so i can still know who send it. But like i said before i cannot receive that message on my corporate email account. Link to comment https://forums.phpfreaks.com/topic/187128-contact-form-with-filter/#findComment-988250 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.