El problema que tengo es que cuando llega el email sale el nombre del servidor, por ejemplo si mi web fuese cristalab el sender que veo cuando me llega el correo es [email protected] cosa que no es cierto pues debería ser mi info@midominio.
aqui dejo el código que utilizo y no funciona pues el mismo da el error message del propio form, lo estoy trabajando en bootstrap con index.php
Código :
<?php if (isset($_POST["submit"])) { $name = $_POST['name']; $lastname = $_POST['lastname']; $email = $_POST['email']; $phone = $_POST['phone']; $company = $_POST['company']; $address = $_POST['address']; $preferences = $_POST['preferences']; $programs = $_POST['programs']; $title = $_POST['title']; $duration = $_POST['duration']; $tox = $_POST['tox']; $service = $_POST['service']; $email_from = '[email protected]';//<== update the email address $from = 'Caption Media'; $to = "[email protected]";//<== update the email address $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $subject = 'Message from Caption Media Submissions '; $body ="From: $name\n Last Name: $lastname\n E-Mail: $email\n Phone: $phone\n Company: $company\n Address: $address\n Preffered Way to be contacted: $preferences\n Programs: $programs\n Title: $duration\n To: $tox\n Service Requested: $service\n"; // Check if name has been entered if (!$_POST['name']) { $errName = 'Please enter your name'; } // Check if name has been entered if (!$_POST['lastname']) { $errLastname = 'Please enter your Last Name'; } // Check if name has been entered if (!$_POST['phone']) { $errPhone = 'Please enter your phone'; } // Check if name has been entered if (!$_POST['address']) { $errAddress = 'Please enter your Address'; } // Check if name has been entered if (!$_POST['company']) { $errCompany = 'Please enter your Company'; } // Check if name has been entered if (!$_POST['programs']) { $errPrograms = 'Please enter Programs'; } // Check if name has been entered if (!$_POST['title']) { $errTitle = 'Please enter Title'; } // Check if name has been entered if (!$_POST['duration']) { $errDuration = 'Please enter Duration'; } // Check if email has been entered and is valid if (!$_POST['email'] || !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { $errEmail = 'Please enter a valid email address'; } // If there are no errors, send the email if (!$errName && !$errEmail) { if (mail ($to, $subject, $body, $from, $headers)) { $result='<div class="alert alert-success">Thank You! We will be in touch</div>'; } else { $result='<div class="alert alert-danger">Sorry there was an error sending your message. Please try again later.</div>'; } } } ?>