Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial



Im trying to send info from my contact form to my email but its showing this warnings:

Warning: mail() [function.mail]: SMTP server response: 501 Your domain does not seem to be valid. Could not find MX record for your domain. in D:\Inetpub\vhosts\drmendozaklein.com\httpdocs\contacto.php on line 22

Warning: Cannot modify header information - headers already sent by (output started at D:\Inetpub\vhosts\drmendozaklein.com\httpdocs\contacto.php:22) in D:\Inetpub\vhosts\drmendozaklein.com\httpdocs\contacto.php on line 23

can someonde help me!


2 Answers

Can you post up the lines of code it refers to? I'm just getting to grips with php but I do like it that it often tells you exactly where your mistake is.

This is the code. thanks


$to_email = "e-mail@hotmail.com";

$name = $_POST["name"]; $email = $_POST["email"]; $message = $_POST["message"];

$subject = "[Te Contactaron] " . $_POST["subject"];

function isValidEmail($email) { return strpos($email, "@") !== false; }

if($name != "" && $email != "" && $message != "" && isValidEmail($email)) {

$full_message = "Name : ". $name . "\n";
$full_message .= "Email : ". $email . "\n";
$full_message .= "Message :\n". $message . "\n";

mail($to_email, $subject, $full_message);      /*line 22*/
header("location: contacto.html");    /*line 23*/



die("Your data is invalid.");