PHP code example of bharatk / mailgunserviceprovider

1. Go to this page and download the library: Download bharatk/mailgunserviceprovider library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bharatk / mailgunserviceprovider example snippets

 {.php}
ilex\Application;
use AchrafSoltani\Provider\MailgunServiceProvider;

$app = new Application();

$app->register(new MailgunServiceProvider(), array(
    'mailgun.api_key' => 'key-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    'mailgun.domain' => 'domain.tld',
));

// Usage

$app->run();
 {.php}
$message = array(
    'from'    => 'Excited User <[email protected]>',
    'to'      => 'Baz <[email protected]>',
    'subject' => 'Greetings!',
    'text'    => 'Testing some Mailgun awesomness!'    
);

$app['mailgun']->sendMessage($message);
 {.php}
$app['mailgun']->post("lists", array(
    'address'     => '[email protected]',
    'description' => 'Mailgun Dev List'
));