I am trying to send data from a contact form to my email adress.
IT IS FROM LOCALHOST - THE SITE IS NOT ONLINE.
My form looks like this:
<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 >
My send_contact.php looks like this:
<?php
// Contact subject
$subject = $_POST['subject'];
// Message from sender
$message = $_POST['detail'];
// Mail of sender
$mail_from = $_POST['customer_mail'];
// Name of sender
$name = $_POST['name'];
// Enter your email address
$to ='myemail@hotmail.com';
$headers = "MIME-Version: 1.0 . \r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1 . \r\n";
$headers .= "From: $mail_from . \r\n";
$send_contact = (mail($to, $subject, $name, $message, $headers));
if($send_contact){
echo "Tak for din forespørgsel.";
header: "location(index.php)";
}
else {
echo "ERROR";
}
?>
With this code I get the following error message after i try to submit the form and send the message to my email:
Warning: mail() [function.mail]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first in C:\wamp\www\enkeltwebdesign\send_contact.php on line 21
The settings in my php.ini looks like this:
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.live.com
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = you@yourdomain
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path =
Can someone see what I am doing wrong?
I dont know if it should be smtp.live.com or pop3.live.com - And other settings might be wrong too, or?
Help highly appreciated!
Jan