forked from sendpulse/sendpulse-rest-api-php
/
index.php
47 lines (40 loc) · 1.17 KB
/
index.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
43
44
45
46
47
<?php
/*
* SendPulse REST API Usage Example
*
* Documentation
* https://login.sendpulse.com/manual/rest-api/
* https://sendpulse.com/api
*/
require_once( 'api/sendpulseInterface.php' );
require_once( 'api/sendpulse.php' );
// https://login.sendpulse.com/settings/#api
define( 'API_USER_ID', '' );
define( 'API_SECRET', '' );
define( 'TOKEN_STORAGE', 'file' );
$SPApiProxy = new SendpulseApi( API_USER_ID, API_SECRET, TOKEN_STORAGE );
// Get Mailing Lists list example
var_dump( $SPApiProxy->listAddressBooks() );
// Send mail using SMTP
$email = array(
'html' => '<p>Hello!</p>',
'text' => 'text',
'subject' => 'Mail subject',
'from' => array(
'name' => 'John',
'email' => 'John@domain.com'
),
'to' => array(
array(
'name' => 'Client',
'email' => 'client@domain.com'
)
),
'bcc' => array(
array(
'name' => 'Manager',
'email' => 'manager@domain.com'
)
)
);
var_dump($SPApiProxy->smtpSendMail($email));