Warning: Failed to connect to mailserver, verify your "SMTP" setting in php.ini

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • appkausman
    New Member
    • Mar 2007
    • 3

    Warning: Failed to connect to mailserver, verify your "SMTP" setting in php.ini

    i am using IBSERVER and trying to mail a form to my email address my code is given below

    form.html
    [code=html]
    <html>
    <head>
    </head>
    <body>
    <form method="POST" action="mail.ph p">
    Name: <input type="TEXT" name="subject">
    Email: <input type="TEXT" name="email">
    <input type="SUBMIT" name="Submit" value="ok">
    </form>
    </body>
    </html>
    [/code]

    mail.php
    [code=php]
    <?PHP
    $email = $HTTP_POST_VARS[email];
    $mailto="muskhe re@gmail.com";
    $mailsubj="Form submission";
    $mailhead="$ema il";
    reset ($HTTP_POST_VAR S);
    $mailbody="Valu es submitted from web site form:\n";
    while (list ($key, $val) = each ($HTTP_POST_VAR S)) { $mailbody .= "$key : $val\n"; }
    if (!eregi("\n",$H TTP_POST_VARS[email])) {
    mail($mailto, $mailsubj, $mailbody, $mailhead);
    }
    else
    {
    echo("Error, no comments were submitted!");
    }
    ?>
    [/code]
    Last edited by Atli; Jul 15 '07, 04:28 AM. Reason: Added [code] tags
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi and welcome to TSDN!

    To be able to use the mail() function you must have a working SMTP server and you must set the following lines in you php.ini file so they will point to you SMTP server.

    [code=text]
    SMTP = localhost
    smtp_port = 25
    [/code]

    Comment

    • appkausman
      New Member
      • Mar 2007
      • 3

      #3
      Originally posted by Atli
      Hi and welcome to TSDN!

      To be able to use the mail() function you must have a working SMTP server and you must set the following lines in you php.ini file so they will point to you SMTP server.

      [code=text]
      SMTP = localhost
      smtp_port = 25
      [/code]
      THANKS very much for your replay
      how can i have working SMTP server i am using IBSERVER
      can you tell me how to do that thanks very again

      Comment

      • appkausman
        New Member
        • Mar 2007
        • 3

        #4
        Originally posted by appkausman
        THANKS very much for your replay
        how can i have working SMTP server i am using IBSERVER
        can you tell me how to do that thanks very again

        i have tried it but it still not working can u help me further... please

        Comment

        • Atli
          Recognized Expert Expert
          • Nov 2006
          • 5062

          #5
          I'm not sure what IBSERVER is, so I can't really give you any real advise on that system, but there has been a lot of discussion about this topic on these forums.

          Check out these topics, they might help you.
          Join 420,000+ software developers and IT professionals


          Join 420,000+ software developers and IT professionals

          Comment

          Working...