Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    567
    Thanks
    2
    Thanked 4 Times in 4 Posts

    Me and the mail() function - one has to loose

    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:
    Code:
    if (mail('myrealaddress@yahoo.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
    Apache 1.3.26
    Scott Stewart
    Always happy to learn from pros.

  • #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,044
    Thanks
    2
    Thanked 316 Times in 308 Posts
    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.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #3
    Regular Coder meth's Avatar
    Join Date
    Jan 2003
    Posts
    262
    Thanks
    0
    Thanked 9 Times in 9 Posts
    Please try:

    PHP Code:
    $mail =  (mail('myrealaddress@yahoo.com','Getting this to work','what the hell is it going to take?','From:noReply@mydomain.com')) ? 'email ok' 'email failed';
    echo 
    $mail
    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.
    I do Web Design, Brisbane based.
    More time spent in PHP/MySQL Web Development.
    And Search Engine Optimisation takes up the rest of it.

  • #4
    Regular Coder
    Join Date
    Nov 2002
    Posts
    567
    Thanks
    2
    Thanked 4 Times in 4 Posts
    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 = me@localhost.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.
    Scott Stewart
    Always happy to learn from pros.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •