2013-07-19 05:09:13 +04:00
|
|
|
<?php
|
2013-07-18 07:23:10 +04:00
|
|
|
//require 'vendor/autoload.php';
|
2013-07-20 04:00:07 +04:00
|
|
|
|
2013-07-23 09:11:01 +04:00
|
|
|
require dirname(__DIR__) . '/vendor/autoload.php';
|
2013-07-23 07:55:41 +04:00
|
|
|
|
|
|
|
use Mailgun\Common\Client;
|
|
|
|
use Mailgun\Common\Message;
|
2013-07-18 09:48:12 +04:00
|
|
|
|
|
|
|
use Mailgun\Exceptions\NoDomainsConfigured;
|
|
|
|
use Mailgun\Exceptions\HTTPError;
|
|
|
|
|
|
|
|
|
2013-07-23 07:55:41 +04:00
|
|
|
$client = new Client("key-ca6d168e492611df8307001d60d24a9c-0b27e", "aawdawdad.ninomail.com", true);
|
2013-07-20 04:00:07 +04:00
|
|
|
|
2013-07-23 07:55:41 +04:00
|
|
|
$message = new Message(array('from' =>"travis@aawdawdad.ninomail.com", 'to' => "travis@tswientek.com", "subject" => "subject here", "text" => "hello", "o:testmode" =>true));
|
2013-07-19 05:09:13 +04:00
|
|
|
|
2013-07-23 04:20:32 +04:00
|
|
|
$response = $client->sendMessage($message->getMessage());
|
|
|
|
echo $response->getBody();
|
2013-07-19 05:09:13 +04:00
|
|
|
|
|
|
|
|
2013-07-23 04:20:32 +04:00
|
|
|
//$message = new Mailgun\Common\Message($client);
|
|
|
|
/*
|
|
|
|
$message = new Mailgun\Common\BatchMessage($client, true);
|
2013-07-19 05:09:13 +04:00
|
|
|
|
2013-07-20 04:00:07 +04:00
|
|
|
$message->setFromAddress("travis@tswientek.com", "From Name");
|
2013-07-23 04:20:32 +04:00
|
|
|
$message->setSubject("%recipient.first%, This is the subject of the message!");
|
|
|
|
$message->setTextBody("%recipient.first%, This is the text body of the message!");
|
|
|
|
$message->setHtmlBody("%recipient.first%, %recipient.my.id% This is the html body of the message!");
|
2013-07-20 04:00:07 +04:00
|
|
|
$message->addAttachment("@GitHub_Logo.png");
|
2013-07-23 04:20:32 +04:00
|
|
|
$message->addAttachment("@batman-logo-big.gif");
|
2013-07-20 04:00:07 +04:00
|
|
|
$message->setTestMode("yes");
|
|
|
|
$message->setDkim("yes");
|
2013-07-23 04:20:32 +04:00
|
|
|
//$message->setDeliveryTime("January 15, 2014 8:00AM", "CST");
|
2013-07-20 04:00:07 +04:00
|
|
|
$message->setOpenTracking("yes");
|
|
|
|
$message->setClickTracking("yes");
|
|
|
|
$message->addCustomOption("o:myoption", "true");
|
|
|
|
$message->addCampaignId("askldf");
|
2013-07-23 04:20:32 +04:00
|
|
|
$message->addCustomData("mycustomdata", array("name"=> "travis"));
|
2013-07-20 04:00:07 +04:00
|
|
|
|
2013-07-23 04:20:32 +04:00
|
|
|
//echo $message->sendMessage();
|
|
|
|
//$message->addBatchRecipient("travis@tswientek.com", array("first" => "Travis", "last" => "Swientek", "my.id" => "ABC12345"));
|
|
|
|
|
|
|
|
|
|
|
|
for($i = 0; $i<5; $i++){
|
|
|
|
$message->addBatchRecipient("travis@".$i."test.com", array("first" => "$i - First", "last" => "$i - Last", "my.id" => "ABC12345"));
|
|
|
|
}
|
|
|
|
|
|
|
|
$message->endBatchMessage();
|
2013-07-18 07:23:10 +04:00
|
|
|
|
|
|
|
|
2013-07-23 04:20:32 +04:00
|
|
|
//echo $client->sendMessage($message->getMessage())->getBody();
|
2013-07-18 07:23:10 +04:00
|
|
|
|
2013-07-23 04:20:32 +04:00
|
|
|
*/
|
2013-07-18 07:23:10 +04:00
|
|
|
?>
|