*/ /* No Space Between PHP and HTML */ /*
*/ $error = ""; $name = ""; $emailaddress = ""; $phonenumber = ""; $emailmessagebody = ""; if ($_SERVER['REQUEST_METHOD']== "POST") { /* Check all form inputs using check_input function */ if (empty($_POST['Name'])) { $error = "no-name"; } if (empty($_POST['EmailAddress'])) { $error = "no-email-address"; } if (empty($_POST['PhoneNumber'])) { $error = "no-phone-number"; } if (empty($_POST['EmailMessageBody'])) { $error = "no-email-message-body"; } if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $_POST['EmailAddress'])) { $error = "no-valid-email"; } $name = $_POST['Name']; $emailaddress = $_POST['EmailAddress']; $phonenumber = $_POST['PhoneNumber']; $emailmessagebody = $_POST['EmailMessageBody']; if (empty($error)) { error_reporting(E_ALL); ini_set('display_errors', 1); include_once('../../../class/phpmailer/class.phpmailer.php'); require_once('../../../class/phpmailer/class.smtp.php'); $mail = new PHPMailer; $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only $mail->IsMail(); $mail->IsHTML(true); $mail->SetFrom("noreply@" . $host . ""); $mail->Subject = $company_name . " - Website Inquiry"; $mail->AddCustomHeader("X-MSMail-Priority: High"); $mail->AddCustomHeader("X-Priority: 1 (Highest)"); $message = "This email has been sent to you from: " . $company_url; $message .= "

"; $message .="Replying to this email message directly will result in an unsent email. To reply to this email message, copy the email address below into the To field of a new email message."; $message .= "

"; $message .="If this email is routing to your Junk Email folder, be sure to mark this email as 'Not Junk' in your email client software or via webmail."; $message .= "

"; $message .="You have received the following Website Inquiry:"; $message .= "

"; $message .="Contact Information"; $message .= "

"; $message .="Name: $name
"; $message .="E-mail: $emailaddress
"; $message .="Phone Number: $phonenumber
"; $message .="Message: $emailmessagebody
"; $mail->Body = $message; $mail->AddAddress($company_email_address); $mail->AddBCC("alan@wellsplastic.com"); $mail->Send(); header("Location: email-sent.html"); exit(); } } ?>

Thank you for your interest in . We look forward to hearing from you.


Please enter your name.

"; } if ($error=='no-email') { echo "
Please enter your email address.

"; } if ($error=='no-phone') { echo "
Please enter your phone number.

"; } if ($error=='no-email-message-body') { echo "
Please enter a message.

"; } if ($error=='no-valid-email') { echo "
Please enter a valid email address.

"; } ?>
Name    
Email    
Phone    
Message    
 
"; ?>