-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsendEmail.php
More file actions
24 lines (20 loc) · 776 Bytes
/
sendEmail.php
File metadata and controls
24 lines (20 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
$to="";
$sub="";
$message="";
$headers='From:'."\r\n".'Reply-To:'."\r\n".'X-Mailer:PHP/'.phpversion();
$result=array();
$result['success']=mail($to,$sub,$message,$headers);
if(array_key_exists('callback', $_GET)){
header('Content-Type: text/javascript; charset=utf8');
header('Access-Control-Allow-Origin: http://www.example.com/');
header('Access-Control-Max-Age: 3628800');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
$callback = $_GET['callback'];
echo $callback.'('.json_encode($result).');';
}else{
// normal JSON string
header('Content-Type: application/json; charset=utf8');
echo json_encode($result);
}
?>