logo-dw

Go Back   Dreamweaver Club Forums > Dreamweaver forums > Dreamweaver General
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 04-12-2016, 05:55 PM   #1
teresamar2
 
Join Date: Oct 2010
Posts: 20
Default mail form problem, PLEASE HELP!

Ok, since I couldn't get any help with my first mail form, I replaced it with a form I found here in an old post. With this form, I can fill out the form, submit, and get the thank you note, but the form info does not go to my email address. I have tried figuring out the correct way to do this for days now and really hope someone can help me. Below is the code.

Code:
<?php
  $machine = $_POST['myrealname'];
    if ($machine != "")
    { echo 'naff off spammer';
        exit(); //if a spambot filled out the "machine"
                //field, we don't proceed
    }
        else{
 
 
    if (isset($_POST['Submit']) && $_POST['name'] != "") {
		
		$th_url= "thankyou.html";   // modify to page redirect after mail succsessfully sent
 
        if ($_POST['name'] != "") {
            $_POST['name'] = filter_var($_POST['name'], FILTER_SANITIZE_STRING);
            if ($_POST['name'] == "") {
                $errors .= 'Please enter a valid name.<br/><br/>';
            }
        } else {
            $errors .= 'Please enter your name.<br/>';
        }
 
        if ($_POST['email'] != "") {
            $email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL);
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
                $errors .= "$email is <strong>NOT</strong> a valid email address.<br/><br/>";
            }
        } else {
            $errors .= 'Please enter your email address.<br/>';
        }
		
	/*	Validating  web address in form field  **********************************************     */
		
		   if ($_POST['website'] != "") {
            $website = filter_var($_POST['website'], FILTER_SANITIZE_URL);
            if (!filter_var($website, FILTER_VALIDATE_URL)) {
                $errors .= "$website is <strong>NOT</strong> a valid URL.<br/><br/>";
            }
        } else {
            $errors .= 'Please enter your home page.<br/>';
        }
	/*	 end Validating  web address in form field  **********************************************     */	
 
      
        if ($_POST['Message'] != "") {
            $_POST['Message'] = filter_var($_POST['Message'], FILTER_SANITIZE_STRING);
            if ($_POST['Message'] == "") {
                $errors .= 'Please enter a message to send.<br/>';
            }
        } else {
            $errors .= 'Please enter a message to send.<br/>';
        }
 
        if (!$errors) {
            $to = 'awesomespaders1@gmail.com';
            $subject = 'New Mail from  ' . $_POST['email'];
			
			  $headers = "From: " . strip_tags($to) . "\r\n";
  $headers .= "Reply-To: ". strip_tags($to) . "\r\n";
   $headers .= "MIME-Version: 1.0\r\n";
  $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
			
		$message = '<html><body>';
 
$message .= '<table width="100%";  style="border:1px solid #3A5896;" cellpadding="10">';
$message .='<tr><td>'. 'From: ' . $_POST['name'].  '</td></tr>'; 
$message .= '<tr><td >'.'Email from: ' . $_POST['email'] . ' </td></tr>'; 
 $message .= '<tr><td >'."Message:\n" . $_POST['Message'] . ' </td></tr>'; 
$message .= "</table>";
 
$message .= "</body></html>";	
			
            mail($to, $subject, $message, $headers );
 
          
    header("Location: $th_url");
			
        } else {
            echo '<div style="color: red">' . $errors . '<br/></div>';
        }
    }
		}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Contact</title>
<style>
#form{
 position:relative;
 width: 500px;
 margin:0 auto;
}
 label {
     float:left;
    clear:left;
}
 input[type="text"], [type="url"], [type="email"]{
	 float:left;
    color: #555 ;
    width: 70%;
    border: 1px solid #e5e5e5;
    background: #fbfbfb;
    height: 25px;
}
 .textarea{
	  float:left;
    height:100px;
      width: 70%;
}
.robotic { display: none; }
</style>
</head>
<body>
<div id="form">
<form action="" method="post">     
   <fieldset>
            <label for="name">Name:</label>
            <input id="name" name="name" type="text" required 
            placeholder=" Your name"   >
          </fieldset>
         <fieldset>       
            <label >Email:</label>
            <input type="email" id="email" name="email" placeholder="me@mymail.com" required >
                    </fieldset>
         <fieldset>  
   
            <label>Website:</label>
            <input type="url" id="website" name="website"  placeholder=" http://mysite.com" required >
                    </fieldset>
         <fieldset>  
            <label>Message</label>
            <textarea class="textarea" name="Message" id="Message"  ></textarea>     
           </fieldset>
         <fieldset>  
         <input class="robotic" type="text" name="myrealname" id="myrealname" >
            <input type="submit" name="Submit" value="Submit">    <input name="reset" type="reset">
           </fieldset>
    
</form> 
 </div>     
</body>
</html>
teresamar2 is offline   Reply With Quote
Old 04-14-2016, 07:58 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,175
Default

sorry just back from visit to uk, i will look at this later and get back
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 04-14-2016, 08:26 AM   #3
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,175
Default

just tested and it works fine. do you get any errors showing?
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 04-14-2016, 08:31 AM   #4
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,175
Default

i see that the info is from awesome... and to awesome ..., perhaps you couls look at the headers to make sure you have the correct values . alo the required for their web site may cause issues if the dont have.
if you want to test offline download and use tesy mail server tool . its a free bie and can help locate any error
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:43 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com