0

I'm trying to do a simple contact form and have it send to an e-mail but its giving me an error after clicking submit. Here's my code:

    <form action="contact.php" method="post">
        <fieldset>
            <legend>Contact Information</legend>
                First Name: <input type="text" name="fname" id="fname" value="" /><br />
                Last Name: <input type="text" name="lname" id="lname" value="" /><br />
                Phone Number: <input type="text" name="number" id="number" value="" /><br />
                E-Mail Address: <input type="text" name="email" id="email" value=""  /><br />
                Confirm E-Mail Address: <input type="text" name="confemail" id="confemail" value=""  /><br />
        </fieldset><br />
        <fieldset>
            <legend>Extra Info</legend>
                <label for="youneed">Tell Us What You Need:</label><br />
                    <textarea name="youneed" value="youneed"></textarea>
        </fieldset><br />
        <fieldset>
            <legend>Submit And We'll Get Back To You</legend>
                <input type="submit" id="submit" value="Submit" />
        </fieldset>                  
    </form>




<?php

if (isset($_POST["email"])) ;
    {
        $myemail ="contact@daintydeliites.com" ;
        $subject ="Contact Form From DD Site" ;
        $mailheader ="From:" . $_POST["email"] . "\r \n" ;
        $mailheader ="Reply-To:" . $_POST["email"] . "\r \n" ;
        $mailheader ="Content-type: text/html" ;
        $MESSAGE_BODY ="First Name:" . $_POST["fname"] . " " ;
        $MESSAGE_BODY ="Last Name:" . $_POST["lname"] . " " ;
        $MESSAGE_BODY ="Phone Number:" . $_POST["number"] . " " ;
        $MESSAGE_BODY ="E-Mail Address:" . $_POST["email"] . " " ;
        $MESSGAE_BODY ="I Need:" . $_POST["youneed"] . " " ;

        mail ($myemail, $subject, $MESSAGE_BODY, $mailheader);

    }
else
    {
        die("Your email failed to send, please check your email address.");
    }


?>
5
Contributors
6
Replies
8
Views
5 Years
Discussion Span
Last Post by AARTI SHRIVAS
0

Warning: mail(): Failed to connect to mailserver at "smtp.1and1.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\webDev\DDCC\site\contact.php on line 27

0

P.S. those codes are in 2 seperate files. line 27 the are talking about is line 39 in the above code.

0

is easyphp have a sendmail packaged with it? Browsse your local server and look for mercuryMail or something about the mail. Let me know what do you have in your local server.. You also need to tell me if your local server have a directory called sendmail, and what is your server's loaded configuration file? By giving the proper answers on these questions, I can tell you which php.ini and sendmail.ini file you need to edit to make this work on your localhost..

You need to know all these stuffs and how to set them prior to executing send mail..

Edited by veedeoo: more info added

0

moi il affiche cette erreur je sais pas le sol Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Program Files\EasyPHP-12.1\www\action.php on line 15

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.