View Single Post
Old December 15th, 2003, 03:27 AM
richard.york's Avatar
richard.york richard.york is offline
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts

quote:Sami wrote:

But I think you are missing some curly braces and I think your script should read like this...
Its true that in PHP curly braces become optional if the conditional statement to be executed contains only one line... so...

if (mail($mail_to, $mail_subject, $mailbody))
   echo "Email Sent";
   echo "An error has occored while trying to send this email"; perfectly acceptable. When the conditional statement contains greater than 1 line the curly braces are required as delimiters since the program won't know where you intend the conditional statement to terminate.

On to Pi's problem..

Pi.. it would seem to me that your ISP doesn't have sendmail set up properly, or the path provided to php.ini to the Sendmail application could be invalid... or worse yet they may have blocked access to the mail function. I've never tried to execute a call to the mail function on a server in which Sendmail was not set up properly so I wouldn't know if that would trigger an error in PHP. One would think so. So at this point its best to check with your ISP or Server Admin. You are setting up the function call just as you should. The from field is irrelavent at this point, of course it implies a well built message, but it is optional.

If for some reason your ISP doesn't allow the mail function, then perhaps you could use an SMTP mailer class. There are several floating about the Net and I beleive one is included in PEAR. Not too difficult to set up. Let us know what your ISP says.. and if you need help setting up an SMTP class just let us know.

You can also do a check on your own to see if the mail function is blocked by running phpinfo() .. and this may appear under disable_functions. You might also make note of what appears under the sendmail_path entry and inquire with your ISP if that is the valid path.

Best of luck!
: )

Smiling Souls