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
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

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

    mail.php


    <?PHP
    $email = $HTTP_POST_VARS[email];
    $mailto="muskhere@gmail.com";
    $mailsubj="Form submission";
    $mailhead="$email";
    reset ($HTTP_POST_VARS);
    $mailbody="Values submitted from web site form:\n";
    while (list ($key, $val) = each ($HTTP_POST_VARS)) { $mailbody .= "$key : $val\n"; }
    if (!eregi("\n",$HTTP_POST_VARS[email])) {
    mail($mailto, $mailsubj, $mailbody, $mailhead);
    }
    else
    {
    echo("Error, no comments were submitted!");
    }
    ?>

  • #2
    Regular Coder
    Join Date
    May 2006
    Location
    Wales
    Posts
    820
    Thanks
    1
    Thanked 82 Times in 79 Posts
    You need an SMTP server, usually provided by your ISP.

  • #3
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    how can i get that i am running it on the local host using IB SERVER can you help me further please

  • #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,080
    Thanks
    2
    Thanked 321 Times in 313 Posts
    To be able to send email to anyone but yourself, you need a public mail server. Setting up your own public mail server has a lot of requirements (registered domain name, static IP address or a dynamic IP address and a dynamic DNS service, a name server, DNS records...) along with actually installing and configuring the mail server. You can skip some of these requirements and set up a local private mail server that only you can send to and only you can check mail on, but this still requires you to install and configure the mail server. There are some opensource mail servers (perhaps someone here can provide some links as I don't remember any of them off of the top of my head.)

    If you are just wanting to send email to test your PHP script, you should use your ISP's mail server or if you have a web hosting account, use the mail server they provide. Most ISP's and web hosts will require you to use SMTP authentication to use their mail server and the PHP mail(...) function does not support authentication. In this case you would need to use something like the phpmailer class - http://phpmailer.sourceforge.net/

    As far as the PHP SMTP setting, you need to set this to either the IP address or the host name of the mail server you want PHP to use.

    Let us know which method you want to use and someone can provide more specific instructions for that method.
    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.


  •  

    Posting Permissions

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