0

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=\"&nbsp;Send&nbsp;\"> <input type=\"reset\" name=\"Submit2\" value=\"&nbsp;Ryd formen&nbsp;\">

?>

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?

Edited by Narue: Removed personal information to protect the innocent

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by pritaeas
0

You are trying your hotmail address and pass on your own server ? I think you need to check your user/pass. What smtp server is localhost running ? You set smtpauth to false, yet provide credentials... Which one is it ?

Remember that php is case sensitive. I think ->HOST should be ->Host Passsword (Password) and Emailfrom (EmailFrom) are also wrong I think.

Edited by pritaeas: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.