-
Notifications
You must be signed in to change notification settings - Fork 1
/
Mailee.php
56 lines (47 loc) · 1.47 KB
/
Mailee.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
48
49
50
51
52
53
54
55
56
<?php
/*
// Instalação
sudo apt-get install php5 php5-cli php5-curl
// Uso
Ver o sample.php
*/
require 'ActiveResource.php';
class MaileeConfig extends ActiveResource{
var $site = MAILEE_CONFIG_SITE;
}
class MaileeContact extends MaileeConfig{
var $element_name = 'contacts';
function find_by_internal_id($iid){
$find = $this->find('first', array('internal_id' => $iid));
return $find[0];
}
function unsubscribe($data=array()){
#E.g. data --> {:reason => 'Trip to nowhere', :spam => false}
return $this->put('unsubscribe', $data);
}
function list_subscribe($data=array()){
#E.g. data --> {:list_id => 111} or {:list => 'MyList'} in the second case if the list doesnt exist it will be created
return $this->put('list_subscribe', $data);
}
function list_unsubscribe($data=array()){
#E.g. data --> {:list_id => 111} or {:list => 'MyList'}
return $this->put('list_unsubscribe', $data);
}
}
class MaileeList extends MaileeConfig{
var $element_name = 'lists';
}
class MaileeTemplate extends MaileeConfig{
var $element_name = 'templates';
}
class MaileeMessage extends MaileeConfig{
var $element_name = 'messages';
function test($contacts){
$str = join($contacts,'&contacts[]=');
return $this->put('test', array('contacts[]' => $str), false);
}
function ready($when = 'now', $date = '', $hour = ''){
return $this->put('ready', array('when' => $when, 'after[date]' => $date, 'after[hour]' => $hour), false);
}
}
?>