‘;
$sendTo = ‘Contact Us form of gruppentsolutions.com ‘;
$subject = “GS Contact Us | $_POST[subject] | $_POST[name] $_POST[company_address]”;
$fields = array(‘name’ => ‘name’, ‘company_name’ => ‘Company Name’, ‘phone’ => ‘Phone’, ’email’ => ‘Email’, ‘company_address’ => ‘Company Address’ , ‘feedback_textarea’ => ‘Message’); // array variable name => Text to appear in email
$okMessage = ‘




Your message has been sent successfully…



Thank you for contacting with us!


Our representative will contact with you as soon as possible.

‘;
$errorMessage = ‘There was an error while submitting the form. Please try again later‘;

// let’s do the sending

try
{
$emailText = “GRUPPENT SOLUTIONS ‘S CONTACT US | $_POST[name] $_POST[company_address] | \n=============================\n”;

foreach ($_POST as $key => $value) {

if (isset($fields[$key])) {
$emailText .= “$fields[$key]: $value\n”;
}
}

mail($sendTo, $subject, $emailText, “From: ” . $from);

$responseArray = array(‘type’ => ‘success’, ‘message’ => $okMessage);
}
catch (\Exception $e)
{
$responseArray = array(‘type’ => ‘danger’, ‘message’ => $errorMessage);
}

if (!empty($_SERVER[‘HTTP_X_REQUESTED_WITH’]) && strtolower($_SERVER[‘HTTP_X_REQUESTED_WITH’]) == ‘xmlhttprequest’) {
$encoded = json_encode($responseArray);

header(‘Content-Type: application/json’);

echo $encoded;
}
else {
echo $responseArray[‘message’];
}
?>