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 = '[email protected]';
$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 [email protected]"; }
?>

Link to comment
https://forums.phpfreaks.com/topic/245729-mail-function-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.