-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathREADME
62 lines (43 loc) · 1.25 KB
/
README
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
57
58
59
60
61
62
Mailgun API wrapper for PHP
Documentation:
=============
Please visit our documentation page at
http://documentation.mailgun.net
Installation:
=============
* Simply clone this repo
Samples tryout:
===============
> php run_sample.php samples/using-mailboxes.php
> php run_sample.php samples/sending-messages.php
> php run_sample.php samples/creating-routes.php
PHP-specific issues:
====================
1. Given an active resource object, eg. $mailbox , use $mailbox->p
to get and set mailbox properties safely, like that:
OK:
$mailbox->p->password = "123456";
NOT OK:
$mailbox->password = "123456"
That's done to avoid name collision between the ActiveResource's properties
and the user defined ones.
2. Set api key with care:
OK:
mailgun_init('my-api-key$b');
NOT OK:
mailgun_init("my-api-key$b");
The last one is bad because of the variable expansion attempt.
PHP will think that $b is a variable to be expanded.
Getting started:
================
require_once 'Mailgun.php';
mailgun_init('my-api-key', 'https://mailgun.net/api');
$mailbox = new Mailbox();
$mailboxes = $mailbox->find('all');
foreach ($mailboxes as $m) {
echo $m->p->user."@".$m->p->domain." ".$m->p->size."\n";
}
echo "\n";
For more visit http://documentation.mailgun.net
--
MG team