08-25-2007, 05:38 AM
I have been getting the crap beat out of me by the mail function. It just wont send the mail. I have even tried this simple test:
if (mail('email@example.com','Getting this to work','what the hell is it going to take?'))
The result -
Warning: Unknown error in c:\phpdev5\www\alaskaerrands\index.php on line 135
And when I say myrealaddress I mean I really used a valid email address. I know that the mail function just isn't working for me and it has to do with something other than my code.
PHP Version 4.2.2
08-25-2007, 05:58 AM
What operating system as well?
I searched for "php mail function unknown error" and got back several hits that refer to bug reports. For example - http://bugs.php.net/bug.php?id=14510
I suspect that your php.ini settings related to the mail() function are either incorrect or php is not finding a php.ini file to load in the first place.
Why are you using such an old version of PHP. Version 4.2.2 was released on - 22-Jul-2002.
$mail = (mail('firstname.lastname@example.org','Getting this to work','what the hell is it going to take?','From:noReply@mydomain.com')) ? 'email ok' : 'email failed';
If no default sendmail_from address is defined in php.ini, and you dont include a 'From:' header, then a call to mail() will return an error.
08-26-2007, 02:03 PM
The operating system is windows xp. I did add the additional headers value and included a 'From:' with the same result.
As far as using php 4.2.3 it is the only one that I could get to work with a packaged install from Firepages. Neither WAMP or XAMP would work. Firepages was the only one that would work and he hasn't added newer version of PHP yet. If I could just add php 5.0 and make the neccessary changes on my system then I would upgrade.
My php.ini file has
SMTP = localhost
sendmail_from = email@example.com
and I added the location of the sendmail.dll to my path. So I'll add a real address to the sendmail_from and see what happens.
Thanks for the response.