$email, 'Reply-To' => $email, 'Content-type' => 'text/html; charset=utf-8'];
$bodyParagraphs = ["Name: {$name}", "Email: {$email}", "Message:", $message];
$body = join(PHP_EOL, $bodyParagraphs);
if (mail($toEmail, $emailSubject, $body, $headers))
header('Location: thank-you.html');
} else {
$errorMessage = 'Oops, something went wrong. Please try again later';
}
} else {
$allErrors = join('
', $errors);
$errorMessage = "{$allErrors}
";
}
}
?>