email

MaxBangma
Offline
Last seen: 2 months 2 weeks ago
Mon, 04/10/2017 - 21:10
#1
email

Hello,

How do i fix the CONTACT US email. It's not working properly. A fast answer is much appreciated

Yours truly, Max Bangma fggt

MaxBangma
Offline
Last seen: 2 months 2 weeks ago
Mon, 04/10/2017 - 21:12

My html-code:

<div class="row">

                <div class="contact-form wow fadeInUp" data-wow-delay=".4s">

                    <form class="clearfix" action="processForm.php" method="post">
                        <div class="col-md-6">
                            <input type="text" name="name" == 'Full Name') { this.value = ''; }" == '') { this.value = 'Full Name'; }" value="Full Name"/>
                        </div>

                        <div class="col-md-6">
                            <input type="text" name="email" == 'Email') { this.value = ''; }" == '') { this.value = 'Email'; }" value="Email"/>
                        </div>

                        <div class="col-md-6">
                            <input type="text" == 'Phone') { this.value = ''; }" == '') { this.value = 'Phone'; }" value="Phone"/>
                        </div>

                        <div class="col-md-6">
                            <input type="text" == 'Website') { this.value = ''; }" == '') { this.value = 'Website'; }" value="Website"/>
                        </div>

                        <div class="clearfix"></div>

                        <div class="col-sm-12">
                            <textarea name="message" class="textarea-form" == 'Message or project description') { this.value = ''; }" == '') { this.value = 'Message or project description'; }">Message or project description</textarea>
                        </div>

                        <div class="clearfix"></div>
                        <div>                        <button type="submit"><span class="icofont moon-paper-plane"></span><i>

                    </form>

                </div>

PHP code:

<?php

// Clean up the input values
foreach($_POST as $key => $value) {
if(ini_get('magic_quotes_gpc'))
$_POST[$key] = stripslashes($_POST[$key]);
$_POST[$key] = htmlspecialchars(strip_tags($_POST[$key]));
}

// Assign the input values to variables for easy reference
$name = $_POST["name"];
$email = $_POST["email"];
$message = $_POST["message"];

// Test input values for errors
$errors = array();
if(strlen($name) < 2) {
if(!$name) {
$errors[] = "You must enter a name.";
} else {
$errors[] = "Name must be at least 2 characters.";
}
}
if(!$email) {
$errors[] = "You must enter an email.";
} else if(!validEmail($email)) {
$errors[] = "You must enter a valid email.";
}
if(strlen($message) < 10) {
if(!$message) {
$errors[] = "You must enter a message.";
} else {
$errors[] = "Message must be at least 10 characters.";
}
}

if($errors) {
// Output errors and die with a failure message
$errortext = "";
foreach($errors as $error) {
$errortext .= "<li>".$error."</li>";
}
die("<div class='thanks failure'>The following errors occured:<ul>". $errortext ."</ul></div>");
}
// Send the email
$to = "info@megadrupal.com";
$subject = "Contact Form: $name";
$headers = "From: $email";

mail($to, $subject, $message, $headers);

// Die with a success message
die("<div class='thanks'>Thanks for submitting your email! Our manager will contact you shortly.</div>");

// A function that checks to see if
// an email is valid
function validEmail($email)
{
   $isValid = true;
   $atIndex = strrpos($email, "@");
   if (is_bool($atIndex) && !$atIndex)
   {
      $isValid = false;
   }
   else
   {
      $domain = substr($email, $atIndex+1);
      $local = substr($email, 0, $atIndex);
      $localLen = strlen($local);
      $domainLen = strlen($domain);
      if ($localLen < 1 || $localLen > 64)
      {
         // local part length exceeded
         $isValid = false;
      }
      else if ($domainLen < 1 || $domainLen > 255)
      {
         // domain part length exceeded
         $isValid = false;
      }
      else if ($local[0] == '.' || $local[$localLen-1] == '.')
      {
         // local part starts or ends with '.'
         $isValid = false;
      }
      else if (preg_match('/\\.\\./', $local))
      {
         // local part has two consecutive dots
         $isValid = false;
      }
      else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain))
      {
         // character not valid in domain part
         $isValid = false;
      }
      else if (preg_match('/\\.\\./', $domain))
      {
         // domain part has two consecutive dots
         $isValid = false;
      }
      else if(!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/',
                 str_replace("\\\\","",$local)))
      {
         // character not valid in local part unless 
         // local part is quoted
         if (!preg_match('/^"(\\\\"|[^"])+"$/',
             str_replace("\\\\","",$local)))
         {
            $isValid = false;
         }
      }
      if ($isValid && !(checkdnsrr($domain,"MX") || checkdnsrr($domain,"A")))
      {
         // domain not found in DNS
         $isValid = false;
      }
   }
   return $isValid;
}

?>

cindy
cindy's picture
Offline
Last seen: 3 days 9 hours ago
Tue, 04/11/2017 - 10:22

Please clarify you issue and send us your website url so that we can tak a look at your problem. Or you can send us screenshots of your code and your issue. 

the code you sent us above is incorrect. 

What is this for?

 name="name" == 'Full Name') { this.value = ''; }" == '') { this.value = 'Full Name'; }"

MaxBangma
Offline
Last seen: 2 months 2 weeks ago
Tue, 04/11/2017 - 14:32

My website is:

http://79072.ict-lab.nl/Portfolio-echte/

The weird thing is I dont get a error or warning.

The website says that the post is sent to the emailadress but, I dont receive it on my email inbox.

the code what i am currently using is your W&M template (index8.html and proccesfrom).

I only changed the email where to send to in the proccesform.

cindy
cindy's picture
Offline
Last seen: 3 days 9 hours ago
Wed, 04/12/2017 - 09:53

Hi,

Please Check Your Website Url Again. It Has Error. Which Type Of Your Hosting?  Linux Or Windows?

Sorry But Email Cannot Be Sent In Windows, Only In Linux

If You Are Using Linux, Please Follow The Setting:

Image title

Log in or register to post comments