Skip to content

leeomara/mailgun.php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

PHP wrapper for Mailgun API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published