Re: [PHP] OS need anything for mail() to work?

[email protected] (Jason Pruim) Fri, 25 Apr 2008 16:14:17 -0400
Newsgroups php.general
Message-ID <[email protected]>
On Apr 25, 2008, at 2:07 PM, Brian Dunning wrote:

> I'm running PHP 5.2.5 on OS X 10.5.2, and using the following code:
>
> ini_set('sendmail_from','[email protected]');
> ini_set('SMTP','working.server.com');
> mail('[email protected]', 'Subject', 'Message');
>
> The servers and addresses are KNOWN TO WORK, I use this same code  
> and same info on a number of different web servers around the world.  
> Authentication is absolutely not the problem. This code works on  
> other computers, but it doesn't work on mine. I get no error, but no  
> email is ever sent.
>
> So my question: Is there something that needs to be installed,  
> running, or otherwise configured on a computer to make sure PHP can  
> send emails? How could I test for this?

Hi Brian,

Since you got no help from Mr. Cummings (M.R.Not...) :)

I thought I would chime in since I'm running 10.4.11 on my server with  
an upgraded php to 5.2 I didn't have to do anything special to make it  
work... For me it just worked.

Here is a really basic contact form I whipped up for someone but it  
works on my server, so should work on yours :)

<?PHP

echo "This is just to get me stats in the code ratings";
$from = "[email protected]";
$returnPath = "[email protected]";
$replyTo = "[email protected]";
	//Build the e-mail headers
	$headers .= "From: ".$from."\r\n";
	$headers .= "Return-Path: ".$returnPath."\r\n";
	$headers .= "Reply-To: ".$replyTo."\r\n";

// Write the email
$message = "It Worked!\n\n";


if(mail($to,$subject,$message,$headers)) {
	//header('Location: ');
	echo "Email was sent!";
	}
	else
	{
	echo " <P>Your email was not sent</P>";
}

?>

See if that works for you...


>
>
>
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[email protected]