I get this error message and no email when I test this form
Warning: mail() [function.mail]: Failed to connect to mailserver at "127.0.0.1" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() ini_set() in \\boswinfs02\home\users\web\b1835\ez.srcfresnocom\PCHSubscomplete.php on line 28
Line 28 is the $send = and the web address is assigned by the webhosting service. Is the problem with my mail function code?
<?php
$to = 'survey@srcfresno.com';
$subject = 'PCH subs';
if (get_magic_quotes_gpc()) { $_POST = array_map('stripslashes',$_POST); }
$fields = array(
'firstname' => 'First Name',
'lastname' => 'Last Name',
'email' => 'Email',
'phone' => 'Phone',
'muchspend' => 'How much did you spend on your purchase today?'
);
$body = "PCH subs:\n\n";
foreach($fields as $a => $b) {
if(array_key_exists($a,$_POST)) {
$body .= sprintf("%s: %s\n",$b,$_POST[$a]);
}
}
$send = mail($to, $subject, $body);
if($send)
{print ""; }
else
{print "We encountered an error sending your mail, please notify webmaster@srcfresno.com"; }
?>