Results 1 to 7 of 7

Thread: mail()

  1. #1

    Thread Starter
    Lively Member DJ P@CkMaN's Avatar
    Join Date
    Jan 2002
    Location
    Burpengary, Queensland, Australia
    Posts
    95

    mail()

    hey all,
    i am trying to use the mail() function but i keep getting this error
    Warning: Failed to Connect in C:\www\root\contact_php\webmaster.php on line 3
    and here is the code.

    PHP Code:
    <?
        if(isset($HTTP_POST_VARS['message'])) {
            mail('[email protected]',$_REQUEST['subject'],$_REQUEST['message'] . '\n\nFrom,\n' . $_REQUEST['from_name'],'From: ' . $_REQUEST['from_email']);
            echo "<b><center>Mail sent!</center></b><br>\n<a href=\"index.php\">Return to home</a><br>\n";
        } else {
            ?>
            <center><b>Email |DJ| P@CkMaN</b></center>
            <form method="post" action="contact.php?action=webmaster">
            Your name: <input type="text" name="from_name" size="35"><br>
            Your email: <input type="text" name="from_email" size="35"><br>
            Subject: <input type="text" name="subject" size="39"><br>
            Message:<br>
            <textarea rows="15" cols="38" name="message"></textarea><br>
            <input type="image" src="../images/buttons/submit.gif" value="Submit" alt="Submit!" name="submit">
            <?
        }
    ?>
    please help me,

    thanks
    There's something I've noticed in the last year or so...
    Australian's are good at EVERYTHING !!!

  2. #2
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    Don't you have problem with echo() instead of mail()?
    PHP Code:
    echo "<b><center>Mail sent!</center></b><br>\n<a href=\'index.php\'>Return to home</a><br>\n"
    Baaaaaaaaah

  3. #3
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616
    Originally posted by abdul
    Don't you have problem with echo() instead of mail()?
    PHP Code:
    echo "<b><center>Mail sent!</center></b><br>\n<a href=\'index.php\'>Return to home</a><br>\n"
    No, his echo statement is correct.

    DJ P@CkMaN
    Are you running this script locally or on a server?
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

  4. #4
    Fanatic Member Gimlin's Avatar
    Join Date
    Dec 2001
    Location
    Hell
    Posts
    734
    cpradio I think you I know where you are going, but if it was local, and he did not configure php.ini

    The error would be "unknown" not "cannot connect" at least it is for me.

  5. #5
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    Originally posted by cpradio


    No, his echo statement is correct.

    DJ P@CkMaN
    Are you running this script locally or on a server?
    Ah ya, I didn't look at the slashes before inside quotes.
    Baaaaaaaaah

  6. #6

    Thread Starter
    Lively Member DJ P@CkMaN's Avatar
    Join Date
    Jan 2002
    Location
    Burpengary, Queensland, Australia
    Posts
    95
    locally
    There's something I've noticed in the last year or so...
    Australian's are good at EVERYTHING !!!

  7. #7
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616
    Well I have to say this just b/c it may be the root of your problem.

    Open your php.ini file and do a Find for the word "mail" (any case)
    Make sure you have it all set properly. Including the send_mb and mail configurations.
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

Posting Permissions

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



Click Here to Expand Forum to Full Width