[UPHPU] mail()

Jonathan Duncan jonathan at bluesunhosting.com
Tue Jul 10 11:49:28 MDT 2007


On 10 Jul 2007, at 09:06, Justin Giboney wrote:

> Is there anything special that a server needs to have to run the  
> mail() function?
> I have apache running on a mac (10.4.10) with no mail/smtp.
>
> this code (from various internet sources), seems to work, but I  
> never get a message
>
> <?php
> $to = "graphics at westernbotanicals.com";
> $subject = "Test mail";
> $message = "Hello! This is a simple email messages.";
> $from = "giboney at giboneydesigns.com";
> $headers = "From: $from";
> if(mail($to,$subject,$message,$headers)) {
> echo "An e-mail was sent to $to with the subject: $subject";
> } else {
> echo "There was a problem sending the mail. Check your code and  
> make sure that the e-mail address $to is valid";
> }
> ?>
>
>

Just to add to the other comments.  I ran into this same problem when  
developing locally.  I did some googling and looking on the Apple  
discussion boards and learned what has already been said, mail() just  
passes of to the local mail server (usually sendmail) which on a Mac  
is disabled by default.  I decided it was not worth it in my case to  
enable or install sendmail.  I just wait until I commit the changes  
to the live server to test the mail functionality.

Jonathan


More information about the UPHPU mailing list