forked from super3/primecoin.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
coinbase-callback.php
38 lines (31 loc) · 1.11 KB
/
coinbase-callback.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
36
37
38
<?php
require 'PHP Mailer/PHPMailerAutoload.php';
header('Content-type: application/json');
$mail = new PHPMailer();
$ok = false;
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$data = file_get_contents("php://input");
$data = json_decode($data);
$message = "Hello,\n Thank you for purchasing a mining guide from Primecoin. \n You'll find your guide attached to this email.\r\n";
$order = array("\r\n", "\n", "\r");
$replace = '<br />';
$html_messasge = str_replace($order, $replace, $message);
$mail->From = '[email protected]';
$mail->FromName = 'Primecoin Guides';
$mail->addAddress($data->customer->email);
$mail->Subject = 'Primecoin Guide Purchase Delivery';
$mail->isHTML(true);
$mail->Body = $html_messasge;
$mail->AltBody = $message;
$mail->addAttachment('guides/' . $data->order->custom . '.pdf');
if($mail->send())
$ok = true;
else
$ok = false;
}
else {
$ok = false;
}
echo $ok ? 'success' : $mail->ErrorInfo;
?>