You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
765 B

<?php
$url = 'https://stupidmailer.herokuapp.com/';
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST',
'content' => '{
"from": "'.$_POST['email'].'",
"to": "matt.huntington@gmail.com",
"subject": "New '.$_SERVER['HTTP_HOST'].' message from '.$_POST['name'].'",
"html": "'.$_POST['message'].'"
}'
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) { echo '{
"status":500,
"error":"could not make request to stupidmailer"
}'; }
echo $result;