-
Notifications
You must be signed in to change notification settings - Fork 0
/
prueba.php
42 lines (36 loc) · 1.1 KB
/
prueba.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
39
40
41
42
<?php
$curl = curl_init('https://netquatro.ip-zone.com/ccm/admin/api/version/2/&type=json');
// Create rcpt array to send emails to 2 rcpts
$rcpt = array(
array(
'name' => 'Miguel',
'email' => '[email protected]'
),
array(
'name' => null,
'email' => '[email protected]'
)
);
$postData = array(
'function' => 'sendMail',
'apiKey' => 'sqlmciqiHk1eCglxFENNTiHShwxJU72CoepGDVpK',
'subject' => 'Mensaje de prueba',
'html' => '<html><head><title>Hola</title></head><body><h1>Hola desde el correo</h1></body></html>',
'mailboxFromId' => 1,
'mailboxReplyId' => 1,
'mailboxReportId' => 1,
'packageId' => 6,
'emails' => $rcpt
);
$post = http_build_query($postData);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$json = curl_exec($curl);
if ($json === false) {
die('Request failed with error: '. curl_error($curl));
}
$result = json_decode($json);
if ($result->status == 0) {
die('Bad status returned. Error: '. $result->error);
}