DDN350












This page uses php to first check to see if the form is filled out, if not it displays the form. When the form is properly filled out and submitted, it is posted to itself (that is this php page) and then executes the php code to send the email. It then echoes (displays) a message thanking the user for sending the message.

If you set the email to go to a mail server that is not your url's, then that mail server may put your email into the spam folder. You would need to go and check your email's spam folder and mark it as not spam.

To address this problem from the contact-form side, you may be able to modify the 4th value of the php mail function to have a 'respond to' email that is for that email server. See this link for more info if you want to try fixing it on that end.



<style>

.form {
    background-color:rgba(0,0,0,.4);
    font-family:"Palatino Linotype", "Book Antiqua", Palatino, serif;
    font-style:italic;
    font-size:18px;
    color:white;
    padding:8px;
    margin:2px;            
    border:none;
    
            box-shadow: inset 2px 2px 1px 1px rgba(0,0,0,0.2);
       -moz-box-shadow: inset 2px 2px 1px 1px rgba(0,0,0,0.2);
    -webkit-box-shadow: inset 2px 2px 1px 1px rgba(0,0,0,0.2);
    }
    
</style>



<section class="box1" style="padding:20px; width:510px;">
<br />

    <?php
        if (isset($_POST['email']))  {                       //if "email" variable is filled out, send email



		function clean_input($data) {                //a function that cleans the data when sent to it, to make sure it is clean and safe/secure.		
		  $data = trim($data);
		  $data = stripslashes($data);
		  $data = htmlspecialchars($data);
		  return $data;
		}
   
                  $to = "you@your.com";                      //Email information, your email needs to be set up on your hosting account.                     
              $email = clean_input($_POST['email']);       // sends value to the clean_input function to make the data safe and then puts it in the php variable.
            $subject = clean_input($_POST['subject']);    //...
            $message = clean_input($_POST['message']);    //...
            
            mail($to, "$subject", $message, "From:" . $email);  //send email
            
            echo "<span style='color:light-green; font-size:130%; font-family:Tahoma, Geneva, sans-serif;'>Thanks for sending me your note.<br />
                  I will get back with you as soon as I can.</span>";     //Email response
            }
            else {                                                 //if "email" variable is not filled out, display the form
    ?>
    
    
            <form method="post">
                <input    class="form" name="email"   placeholder="your@email.com"  required type="email" />   <input type="submit" value="Send Message" style=" float:right;" /><br />
                <input    class="form" name="subject" placeholder="subject..."      required type="text" /><br />
                <textarea class="form" name="message" placeholder="your message..." required rows="10" cols="40"></textarea><br />
            </form>
    <?php
           }
    ?>

</section>