Skip to content

Instantly share code, notes, and snippets.

@AntoninMarchardDev
Created February 9, 2018 15:42
Show Gist options
  • Save AntoninMarchardDev/92cedeb61ffc980a2074f5786fde0df0 to your computer and use it in GitHub Desktop.
Save AntoninMarchardDev/92cedeb61ffc980a2074f5786fde0df0 to your computer and use it in GitHub Desktop.
<?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