I'm trying to get the PHP mail() function to work with a localhost IIS Virtual SMTP server. However, I keep getting an error message:

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in f:\Inetpub\wwwroot\forms\mail.php on line 4

I don't understand what other settings to change or how to get it to talk to the virtual SMTP domain. Anybody know how?

    There was just a thread about this earlier today or yesterday (days run together).

    Do a search on the forum for it.

    The jist of it is:

    Set your SMTP server setting to point to your ISP's SMTP server, not localhost.

      thanks.

      I did search, actually, but it didn't help. I've tried using the real SMTP server before and tried it again on your recommendation, but in this case I get the following messge:

      Warning: mail() [function.mail]: Failed to connect to mailserver at "ipaddress" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in f:\Inetpub\wwwroot\forms\mail.php on line 11

      So I'm kinda stuck. 🙁

        Are you using yourself as a mail server, or using your ISP? I ask because your error says "ipaddress" not a real address.

        What I meant was; say you use Cox for cable internet.

        Your SMTP setting should be: smtp.cox.com

        Your PORT should be: 25

          yes. I inserted "IP address" in place of the actual ip address used so that spambots don't pick it up.

          K, let me back up & describe the situation. This is on a network at my work. The webserver & virtual SMTP server is to my left. The mail server (that I'm trying to get the virtual SMTP to forward to) is also in the same room. I just can't get it all to talk to each other. I know the IPs of all the machines involved and the domain name of the mail server. I've tried both in php.ini and no luck yet.

          pretty discouraged....

            Welp, all I can think of is that your virtual needs to point to the real mail server.

            Outside of that, you'll need to wait for a response from one of the top guns on the boards.

            i.e. Lordshryku, WeedPacket, laserlight, etc...

            Sorry I cant be more help.

              It's okay. Thanks for taking a look.

              I do know that the virtual SMTP points to the real server because there is an ASP page (black sheep) that successfully uses it to mail. This page was written by someone who is no longer with us, and the code is so damned messy nobody can understand it. Since then I've converted the site to PHP, except for that webform, because I can't get mail() to work.

              Hence my little dilemma here.

              Anybody (big guns?) have any advice?:queasy:

                Write a Reply...