Jump to content

mail() function error


srcfresno

Recommended Posts

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"; }
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.