'Please provide your full name', 'strNumber' => 'Please provide your contact number', 'strEmail' => 'Please provide a valid email address', 'strModel' => 'Please provide the model you are interested in', ); foreach ($validate as $fld => $message) { /* check for blank or missing fields */ if (!isset($_POST[$fld]) || empty($_POST[$fld])) { $errors[$fld] = $message; } /* validate the email address */ if (!validate_email($_POST['strEmail'])) { $errors['strEmail'] = $validate['strEmail']; } } return $errors; } if (isset($_POST['action']) && ($_POST['action'] == 'feedback')) { /* perform validation here */ $errors = validate(); if (count($errors) == 0) { require('phpmailer/class.phpmailer.php'); $mail = new PHPMailer(); $mail->IsSMTP(); // $mail->Host = '10.132.20.10'; $mail->From = $_POST['strEmail']; $mail->AddAddress('feedback@hatfieldcommercialvehicles.co.za'); // $mail->AddAddress('ian.vandenheuvel@ogilvy.co.za'); $mail->Subject = 'Online Request - www.hatfieldcommercialvehicles.co.za'; $mail->Body = mail_body(); $mail->WordWrap = 50; /* $mail->Host = 'smtp.gmail.com'; $mail->Port = 465; $mail->SMTPSecure = 'ssl'; $mail->SMTPAuth = true; $mail->Username = 'ogilvyinteractiveza@gmail.com'; $mail->Password = 'htmlmailer'; */ $mail->Host = 'localhost'; if ($result = $mail->Send()) { header('Location: contact-vw-used-tx.html'); exit(); } } } ?>