Skip to content

Instantly share code, notes, and snippets.

@dshaw002
Created March 24, 2016 16:09
Show Gist options
  • Save dshaw002/25ebaa842d45e87c16f3 to your computer and use it in GitHub Desktop.
Save dshaw002/25ebaa842d45e87c16f3 to your computer and use it in GitHub Desktop.
Postman Snippet
<?php
header("Access-Control-Allow-Origin: *");
header("Content-Type: text/html; charset=utf-8");
$data = array(
'from' => '[email protected]',
'to' => '[email protected]',
'subject' => '',
'text' => ""
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.mailgun.net/v3/sandbox4534.mailgun.org/messages");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERPWD, "api:key-1fvi7s59am2-5h0-kc315f8lnblugwm6");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_exec($ch);
curl_close($ch);
} else {
echo json_encode(array("message" => "Invalid POST Data"));
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment