Email on WinXP IIs

Discussion in 'PHP' started by abrogard, Jun 11, 2012.

  1. #1
    I have this simple test script for use on localhost

    <?php
    if(mail('user@mydomain.com','test subject','test message')){
    echo('ok');
    }
    else{
    echo('not ok');
    }
    ?>

    It echoes nothing at all. It hangs there 'wating for localhost'.

    Localhost is working fine. I can access numerous test site index.html pages on it. I test my sites locally this way before uploading to my hosting provider.

    SMTP is apparently installed, configured, working, as best I can make out.

    Anyone got any ideas how I can troubleshoot this issue?

    I realise it's probably not a PHP issue, but rather an IIS problem. But I'm not making much headway over on the IIS forum and perhaps someone knows of a PHP troubleshooting technique that'd help?

    Possibly it is a fequent occurrence with PHP called email on IIS and the PHP community is aware of it and well knows the probable cause and what to do to handle it.....

    Here's hoping...

    :)
     
    abrogard, Jun 11, 2012 IP
  2. Anveto

    Anveto Well-Known Member

    Messages:
    697
    Likes Received:
    40
    Best Answers:
    19
    Trophy Points:
    195
    #2
    <?php
    if ( function_exists( 'mail' ) )
    {
        echo 'mail() is available';
    }
    else
    {
        echo 'mail() has been disabled';
    } 
    ?>
    PHP:
     
    Anveto, Jun 11, 2012 IP
  3. abrogard

    abrogard Member

    Messages:
    14
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #3
    Yep. Thanks for that. Would have been a good test. As it happens i don't need it because I know mail is available because I now have it working.

    Sure enough it was a common PHP thing, really. Configuration thing. I had to edit php.ini to show the mail server, I think it was, or the domain acceptable to the server, as 'asus' which is the name of my computer. And configured as an alias for 'localhost' on IIS.

    'localhost', the default configuration in php.ini, wouldn't work. I don't know why. I reckon it should have.

    I finished up finding a page that showed me how to send email via telnet as a way of checking the smtp setup.

    And various other things. Very confusing much of it. Talk about leaving the mail in a 'drop box' and at one stage I had mail going to the queue but no further. All very mysterious.

    But now it sends email out into the world wherever I want.

    I think it is also using my installed thunderbird email prog. I think I saw that somewhere in all the tracking it around. So I guess that could well be another 'tweak' or 'glitch' or something: if you don't have an email client installed it perhaps won't send.

    But I never saw any mention of anything like that anywhere.

    And I got the idea that php scripts will not output 'echo' or 'print' from within the script unless the script can complete. Would that be right?
     
    abrogard, Jun 11, 2012 IP