-
Notifications
You must be signed in to change notification settings - Fork 0
/
order.php
35 lines (26 loc) · 864 Bytes
/
order.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/**
* Quick an dirty email order form for markharding.co
*
* @todo make this into a datastore - but emails are free!
*/
use \google\appengine\api\mail\Message;
use google\appengine\api\cloud_storage\CloudStorageTools;
//file_put_contents('gs://vocal-territory-679.appspot.com/hello.txt', 'Hello');
$data = json_decode( file_get_contents('php://input'), true );
$data = $data['data'];
$json = json_encode($data);
try{
$message = new Message();
$message->setSender("mark@kramnorth.com");
$message->addTo("mark@kramnorth.com");
$message->setSubject("New Order from " . $data['name']);
$body = <<<BODY
Mark, you have a new order.
\n
$json
BODY;
$message->setTextBody($body);
// $message->addAttachment('image.jpg', 'image data', $image_content_id);
$message->send();
} catch (InvalidArgumentException $e) {}