Trying to fix a problem with form mail script - works fine on LINUX but throws this error on a Windows machine:
"Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html. in D:\hosting\7762152\html\contact.php on line 28"
I understand this has to do with "bare LF's" (line feeds.) Lines being terminated with "\n" when they should be terminated with "\r\n".
My script:
<?php
$to = "info@domain.com";
$from = $_REQUEST['email'] ;
$phone = $_REQUEST['phone'] ;
$headers = "From: $from";
$subject = "Web Contact Data";
$fields = array();
$fields{"schedule"} = "Schedule";
$fields{"pricing"} = "Pricing";
$fields{"proof"} = "Proof-of-Concept";
$fields{"email"} = "Email Address";
$fields{"phone"} = "Phone Number";
$body = "We have received the following information:\n\n";
foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: info@domain.com";
$subject2 = "Thank You For Acme Software";
$autoreply = "Thank you for contacting Acme Software. We will get back to you as soon as possible, usually within 48 hours.";
if($from == '') {print "You have not entered an email address, please go back and try again";}
else {
if($phone == '') {print "You have not entered a phone number, please go back and try again";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send)
{header( "Location: thankyou.html" );}
else
{print "We encountered an error sending your mail, please notify info@domain.com"; }
}
}
?>
So, I am to replace all instances of \n with \r\n, correct? This fix still throws an error.
Can anyone tell me how to fix this?
Thanks!