Skip to content

Instantly share code, notes, and snippets.

@quentin-aslan
Created October 22, 2016 14:42
Show Gist options
  • Save quentin-aslan/fa1ef275d19ce30ee996f2235d5352d2 to your computer and use it in GitHub Desktop.
Save quentin-aslan/fa1ef275d19ce30ee996f2235d5352d2 to your computer and use it in GitHub Desktop.
<?php
$name = $_POST['nom'];
$subject = $_POST['sujet'];
$email = $_POST['email'];
$text = $_POST['text'];
$dest = "[email protected]";
$data = array(
'dest' => $dest,
'sender' => $email,
'message' => $text,
'subject' => $subject,
'name' => $name
);
$json = json_encode($data);
$ch = curl_init("http://cobra.pata.ovh/sendmail");
curl_setopt($ch, CURLOPT_URL, "https://cobra.pata.ovh/sendmail");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
var_dump($json);
$res = curl_exec($ch);
if($res === FALSE) {
die(curl_error($ch));
}else {
echo "success";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment