Skip to main content
Inspiring
May 17, 2018
Question

Email Contact Form is not working

Somehow, I only updated the 2018 on the bottom of this website and the contact form is not processing the inquiry. I only see the line hour glass functioning but receive no email. I'm posting the link and code, please assist!

https://universalittechnologies.com/contacts.php

<form action="MailHandler.php" method="post" name="contact-form" id="contact-form">

          <div class="contact-form-loader"></div>

          <fieldset>

            <label class="name">

              <input type="text" name="name" placeholder="Name:" value="" data-constraints="@Required @JustLetters"  />

              <span class="empty-message">*This field is required.</span> <span class="error-message">*This is not a valid name.</span> </label>

            <label class="email">

              <input type="text" name="email" placeholder="E-mail:" value="" data-constraints="@Required @Email" />

              <span class="empty-message">*This field is required.</span> <span class="error-message">*This is not a valid email.</span> </label>

            <label class="phone">

              <input type="text" name="phone" placeholder="Phone:" value="" data-constraints="@Required @JustNumbers" />

              <span class="empty-message">*This field is required.</span> <span class="error-message">*This is not a valid phone.</span> </label>

            <label class="message">

              <textarea name="comments" id="comments" placeholder="Message:" data-constraints='@Required @Length(min=20,max=999999)'></textarea>

              <span class="empty-message">*This field is required.</span> <span class="error-message">*The message is too short.</span> </label>

           

     

            <div class="clear"></div>

            <div class="g-recaptcha" data-sitekey="6LfNjP8SAAAAANIM61P8VDcFHRc_LJc0Tbk1TsGN"></div>

            <div> <a href="#" class="btn" data-type="reset">Reset form</a> </div>

            <div> <a href="#" class="btn" data-type="submit">Send e-mail</a> </div>

          </fieldset>

          <div class="modal fade response-message">

            <div class="modal-dialog">

              <div class="modal-content">

                <div class="modal-header">

                  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>

                  <h4 class="modal-title">Modal title</h4>

                </div>

                <div class="modal-body"> You message has been sent! We will be in touch soon. </div>

              </div>

            </div>

          </div>

        </form>

<?php

$errors = array();

if(empty($_POST['name'])){

$errors[] = 'Please enter your name';

} else {

echo  "";

}

if(empty($_POST['email'])){

$errors[] = 'Please enter your email';

} else {

echo "";

}

if(empty($_POST['comments'])){

$errors[] = 'Please enter your comments';

} else {

echo  "";

}

  $emailPattern = '/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i';

  $to = "service@universalittechnologies.com";

//$to ="atlnycdude23@gmail.com";  // ----> Use this $to email declation just in case in a emergency.

$subject = 'Sales Inquiries, Potential/ReturningCustomer Related Questions';

$from = 'Universal IT Technologies';

$name =  safe(stripslashes( $_POST['name']) );

$email =  safe($_POST['email'] );

$phone = safe($_POST['phone'] );

//$cname =  safe ($_POST['cname']);

$comments = safe(stripslashes($_POST['comments']) );

$headers = "From: ". $from . "<" . $to. ">\r\n"; 

$headers .= "Reply-To: " . $email . "\r\n";

$headers .= "Return-path: ". $email;

  $message .= "Name:  " . $name . "\n";

$message .= "Email: " . $email . "\n\n";

$message .= "Phone Number: " . $phone . "\n\n\n";

//$message .= "Company Name:  " . $cname . "\n\n\n\n";

$message .= "Comments: " . $comments . "\n\n\n\n\n\n\n\n";

if (count($errors) < 1){

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

  echo "Thank you so much for your Inquiry. I'm looking forward in serving you soon!";

} else {

  echo "Please go back and enter the requested information";

}

function safe($string)

{

$pattern = "/\r|\n|\%0a|\%0d|Content\-Type:|bcc:|to:|cc:/i";

return preg_replace($pattern, '', $string);

}

?>

This topic is closed to new replies. Start a new post to keep the conversation going.

5 replies

BenPleysier
Community Expert
Community Expert
May 17, 2018

I get this error

POST https://universalittechnologies.com/mail/MailHandler.php 404 (Not Found)

Translate
Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
Nancy OShea
Community Expert
Community Expert
May 17, 2018

When things go south, check your code for errors.

Showing results for https://universalittechnologies.com/contacts.php - Nu Html Checker

Translate
Nancy O'Shea— Product User & Community Expert
Inspiring
May 17, 2018

It was working prior to the simple copyright date update.

Translate
Nancy OShea
Community Expert
Community Expert
May 17, 2018

Do you have a backup cop you can revert to?

Translate
Nancy O'Shea— Product User & Community Expert