Results 1 to 2 of 2

Thread: PHP mail() Problem....Please Help!

  1. #1
    Join Date
    Oct 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation PHP mail() Problem....Please Help!

    Hi!~

    I am working on a simple contact form, and this is my first php one.

    It works perfectly ok, BUT when the user clicks submit, the second page keeps giving the error:

    /var/chroot/home/content/t/i/e/myaddress/dead.letter... Saved message in /var/chroot/home/content/t/i/e/myaddress/dead.letter

    Here's the code:

    PHP Code:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

    <head>
      <title></title>
    </head>

    <body>

                    <!-- Body Start -->

                        <?

                            
    if($Submit !=""){
                            
    $Title "Contact Form Submission!";
                            
    $Body "You recieved the following data: \n \n".$FirstName."\n".$LastName."\n".$EmailAddress."\n".$AreaCode."\n".$TelephoneNumber."\n".$FaxNumber."\n".$Products."\n".$Comments."\n \n Please reply within the next 48 working hours";
                            
    mail($Title"From: $EmailAddress"$Body"To: anstra@shaw.ca");
                            echo 
    "<b>Thankyou for you submission!</b> <br><br> Here is a copy of you information: <br><br>";
                            echo 
    "<b>First Name:</b> ".$FirstName."<br>";
                            echo 
    "<b>Last Name:</b> ".$LastName."<br>";
                            echo 
    "<b>Email Address:</b> ".$EmailAddress."<br>";
                            echo 
    "<b>Area Code:</b> ".$AreaCode."<br>";
                            echo 
    "<b>Telephone Number:</b> ".$TelephoneNumber."<br>";
                            echo 
    "<b>Fax Number:</b> ".$FaxNumber."<br>";
                            echo 
    "<b>Product of Interest:</b> ".$Products."<br>";
                            echo 
    "<b>Comments:</b> ".$Comments."<br><br>";
                            echo 
    "Thankyou, we will be contacting you in the next 48 working hours.";
                            }
                        
    ?>
                        <?
                            
    if($Submit ==""){
                        
    ?>
                        Please fill out our simple contact form and we will reply in the next 48 working hours. Or you may email us directly at <a id="main" href="mailto:someone@someserver.com">&nbsp;someone@someserver.com&nbsp;</a>.<br /><br /><font color="#FF8040">*</font> Denotes Mandatory Field<br />
                        <form method="post" action="23141001642201231.php">
                            <table>
                                <tr>
                                    <td>First Name <font color="#FF8040">*</font></td>
                                    <td width="20" rowspan="8"></td>
                                    <td><input type="text" size="30" maxlength="250" name="FirstName" /></td>
                                </tr>
                                <tr>
                                    <td>Last Name <font color="#FF8040">*</font></td>
                                    <td><input type="text" size="30" maxlength="250" name="LastName" /></td>
                                </tr>
                                <tr>
                                    <td>Email Address <font color="#FF8040">*</font></td>
                                    <td><input type="text" size="25" maxlength="250" name="EmailAddress" /></td>
                                </tr>
                                <tr>
                                    <td>Area Code <font color="#FF8040">*</font></td>
                                    <td><input type="text" size="3" maxlength="250" name="AreaCode" /></td>
                                </tr>
                                <tr>
                                    <td>Telephone Number <font color="#FF8040">*</font></td>
                                    <td><input type="text" size="7" maxlength="250" name="TelephoneNumber" /></td>
                                </tr>
                                <tr>
                                    <td>Fax Number</td>
                                    <td><input type="text" size="10" maxlength="250" name="FaxNumber" /></td>
                                </tr>
                                <tr>
                                    <td>Product of Interest</td>
                                    <td><select name="Products">
                                        <option></option>
                                    </select></td>
                                </tr>
                                <tr>
                                    <td>Comments <font color="#FF8040">*</font></td>
                                    <td><textarea name="Comments" rows="8" cols="40"></textarea></td>
                                </tr>
                            </table><br /><br /><input name="Submit" type="Submit" value="Send Data" />&nbsp;<input type="reset" value="Clear all Data" />
                        </form>


                        <?
                            
    }
                        
    ?>
                    <!-- Body End -->
     
    </body>

    </html>
    If anyone can point me in the right direction I will be eternally grateful

    Thanks,
    Tristan

  2. #2
    Join Date
    Oct 2006
    Location
    Shanghai, China
    Posts
    36
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Try this:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
    <title></title>
    </head>
    
    <body>
    
    <!-- Body Start -->
    
    <?
    
    if($Submit !=""){
    $to      = "anstra@shaw.ca";
    $subject = "Contact Form Submission!";
    $message = "You recieved the following data: \n \n".$FirstName."\n".$LastName."\n".$EmailAddress."\n".$AreaCode."\n".$TelephoneNumber."\n".$FaxNumber."\n".$Products."\n".$Comments."\n \n Please reply within the next 48 working hours";
    $headers = "From: $EmailAddress";
    mail($to, $subject, $message, $headers);
    echo "<b>Thankyou for you submission!</b> <br><br> Here is a copy of you information: <br><br>";
    echo "<b>First Name:</b> ".$FirstName."<br>";
    echo "<b>Last Name:</b> ".$LastName."<br>";
    echo "<b>Email Address:</b> ".$EmailAddress."<br>";
    echo "<b>Area Code:</b> ".$AreaCode."<br>";
    echo "<b>Telephone Number:</b> ".$TelephoneNumber."<br>";
    echo "<b>Fax Number:</b> ".$FaxNumber."<br>";
    echo "<b>Product of Interest:</b> ".$Products."<br>";
    echo "<b>Comments:</b> ".$Comments."<br><br>";
    echo "Thankyou, we will be contacting you in the next 48 working hours.";
    }
    ?>
    <?
    if($Submit ==""){
    ?>
    Please fill out our simple contact form and we will reply in the next 48 working hours. Or you may email us directly at <a id="main" href="mailto:someone@someserver.com">&nbsp;someone@someserver.com&nbsp;</a>.<br /><br /><font color="#FF8040">*</font> Denotes Mandatory Field<br />
    <form method="post" action="23141001642201231.php">
    <table>
    <tr>
    <td>First Name <font color="#FF8040">*</font></td>
    <td width="20" rowspan="8"></td>
    <td><input type="text" size="30" maxlength="250" name="FirstName" /></td>
    </tr>
    <tr>
    <td>Last Name <font color="#FF8040">*</font></td>
    <td><input type="text" size="30" maxlength="250" name="LastName" /></td>
    </tr>
    <tr>
    <td>Email Address <font color="#FF8040">*</font></td>
    <td><input type="text" size="25" maxlength="250" name="EmailAddress" /></td>
    </tr>
    <tr>
    <td>Area Code <font color="#FF8040">*</font></td>
    <td><input type="text" size="3" maxlength="250" name="AreaCode" /></td>
    </tr>
    <tr>
    <td>Telephone Number <font color="#FF8040">*</font></td>
    <td><input type="text" size="7" maxlength="250" name="TelephoneNumber" /></td>
    </tr>
    <tr>
    <td>Fax Number</td>
    <td><input type="text" size="10" maxlength="250" name="FaxNumber" /></td>
    </tr>
    <tr>
    <td>Product of Interest</td>
    <td><select name="Products">
    <option></option>
    </select></td>
    </tr>
    <tr>
    <td>Comments <font color="#FF8040">*</font></td>
    <td><textarea name="Comments" rows="8" cols="40"></textarea></td>
    </tr>
    </table><br /><br /><input name="Submit" type="Submit" value="Send Data" />&nbsp;<input type="reset" value="Clear all Data" />
    </form>
    
    
    <?
    }
    ?>
    <!-- Body End -->
    
    </body>
    
    </html>

Bookmarks

Posting Permissions

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