Hi,
I have found a REALLY simple contact form, which i am trying to mail to my own email for testing.
But I havent tried this before so i am not sure how to set it up.
Hope someone can help me out!
I get this error:
( ! ) Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\enkeltwebdesign\send_contact.php on line 21
I havent set up anything, so was kind of expecting it to go crazy when i submitted.
Can someone hint me on how to setup the mail function correct?
My code looks like this, just the core contact stuff, and processing which might be wrong too :-/
//The Form
<form name=\"form1\" method=\"post\" action=\"send_contact.php\">
<p>Emne:</p><input name=\"subject\" class=\"input\" type=\"text\" id=\"subject\" size=\"64\"><br /><br />
<p>Forespørgsel:</p><textarea name=\"detail\" cols=\"50\" rows=\"7\" id=\"detail\"></textarea><br /><br />
<p>Navn:</p><input name=\"name\" class=\"input\" type=\"text\" id=\"name\" size=\"64\"><br /><br />
<p>Email:</p><input name=\"customer_mail\" class=\"input\" type=\"text\" id=\"customer_mail\" size=\"64\"><br /><br />
<input type=\"submit\" name=\"Submit\" value=\" Send \"> <input type=\"reset\" name=\"Submit2\" value=\" Ryd formen \">
The form processing:
<?php
// Contact subject
$subject = $_POST['subject'];
// Details
$message= $_POST['detail'];
// Mail of sender
$mail_from= $_POST['customer_mail'];
// From
$header="from: $name <$mail_from>"; // This is wrong I think? Undefined variable?
// Enter your email address
$to ='mail@mail.com';
$send_contact=mail($to,$subject,$message,$header); // This is wrong I think?
// Check, if message sent to your email
// display message "We've recived your information"
if($send_contact){
echo "Tak for din forespørgsel.";
}
else {
echo "ERROR";
}
?>