Created
February 9, 2018 15:42
-
-
Save AntoninMarchardDev/92cedeb61ffc980a2074f5786fde0df0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if($_POST){ | |
$email = $_POST['email']; | |
$name = $_POST['name']; | |
$object = $_POST['objet']; | |
$message = $_POST['message']; | |
$headers = "MIME-Version: 1.0\r\n"; | |
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n"; | |
$headers .= "From: $name <$email>\r\nReply-to : $name <$email>\nX-Mailer:PHP"; | |
$subject="$objet"; | |
$destinataire="antonin.marchard@gmail.com"; | |
$body="$message"; | |
if(mail($destinataire,$subject,$body,$headers)) { | |
$response['status'] = 'success'; | |
$response['msg'] = 'your mail is sent'; | |
} else { | |
$response['status'] = 'error'; | |
$response['msg'] = 'Something went wrong'; | |
} | |
echo json_encode($response); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment