I need to process/send this form
<?php
<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 \">
?>
I am trying to recieve it and send it with phpmailer, which i downloaded and saved in my includes folder of the site.
Havent done this before so please correct me where I have made weird code..
<?php
require_once("includes/phpmailer/class.phpmailer.inc.php");
require_once("includes/phpmailer/class.smtp.inc.php");
// Contact subject
$subject = $_POST['subject'];
// Details
$message = $_POST['detail'];
// Mail of sender
$mail_from = $_POST['customer_mail'];
// From
$header = "from: $mail_from";
// Enter your email address
$to ='foo@bar.com';
// Dette vil køre med SMTP
$mail = new PHPMailer();
$mail ->IsSMTP();
$mail ->HOST = "localhost";
$mail ->Port = 25;
$mail ->SMTPAuth = false;
$mail ->Username = "foo@bar.com";
$mail ->Passsword = "foobar";
$mail ->Emailfrom = $email_from;
$mail ->AddAddress($to);
$mail ->Body = $message;
$mail ->Subject = $subject;
$send_contact = $mail->Send();
// 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";
}
?>
And this is not working - Can someone see why?