Sending Attacment with Mailgun

Here is a php code to send single/multiple attachments via mailgun.


# Include the Autoloader (see "Libraries" for install instructions)
require 'vendor/autoload.php';
use Mailgun\Mailgun;

# Instantiate the client.
$mgClient = new Mailgun('key-3ax6xnjp29jd6fds4gc373sgvjxteol0');
$domain = "samples.mailgun.org";

$sendData = array(  'from'    => 'Excited User ',
        'to'      => 'Mailgun Devs ',
        'subject' => 'Hello',
        'text'    => 'Testing some Mailgun awesomeness!');

$files = array("media/11.jpg", "doc/12.doc");

# Make the call to the client.
$messageID = $mgClient->sendMessage("$domain", $sendData, $files);