当前位置: 首页>>代码示例>>PHP>>正文


PHP Mailgun::get方法代码示例

本文整理汇总了PHP中Mailgun\Mailgun::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailgun::get方法的具体用法?PHP Mailgun::get怎么用?PHP Mailgun::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mailgun\Mailgun的用法示例。


在下文中一共展示了Mailgun::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: parse

 /**
  * Parses an array of email addresses into two lists: parsed addresses and unparsable portions.
  * The parsed addresses are a list of addresses that are syntactically valid (and optionally
  * have DNS and ESP specific grammar checks).
  * The unparsable list is a list of characters sequences that the parser was not able to
  * understand. These often align with invalid email addresses, but not always.
  *
  * @param array|string $addresses
  * @param bool         $syntaxOnly
  *
  * @return mixed
  */
 public function parse($addresses, $syntaxOnly = false)
 {
     if (is_array($addresses)) {
         $addresses = implode(',', $addresses);
     }
     $syntaxOnly = $syntaxOnly ? 'true' : 'false';
     return $this->mailgun->get('address/parse', ['addresses' => $addresses, 'syntax_only' => $syntaxOnly])->http_response_body;
 }
开发者ID:bogardo,项目名称:mailgun,代码行数:20,代码来源:Validator.php

示例2: __invoke

 /**
  * Show mailgun status
  *
  * @return Response
  */
 public function __invoke()
 {
     $mg = new Mailgun(env('MAILGUN_API_KEY'));
     $domain = env('MAILGUN_DOMAIN');
     //TODO better error handling if mailgun API is not accessible
     $logs = $mg->get("{$domain}/log", array('limit' => 16, 'skip' => 0))->http_response_body->items;
     $domainResponse = $mg->get("domains/{$domain}");
     $domain = $domainResponse->http_response_body->domain;
     $responseCode = $domainResponse->http_response_code;
     return view('admin.mailgun.index', compact('logs', 'domain', 'responseCode'));
 }
开发者ID:mattvb91,项目名称:website-laravel,代码行数:16,代码来源:MailgunController.php

示例3: sendVerificationEmail

 public function sendVerificationEmail($where, $what)
 {
     # First, instantiate the SDK with your API credentials and define your domain.
     $msg = new Mailgun(Config::get('mailgun/secret'));
     $domain = Config::get('info/domain');
     # Now, compose and send your message.
     $msg->sendMessage($domain, array('from' => Config::get('mailgun/from_email'), 'to' => $where, 'subject' => "Your BernBuds email validation code is: {$what}", 'text' => "Your BernBuds email validation code is: {$what}"));
     $result = $msg->get("{$domain}/log", array('limit' => 1, 'skip' => 0));
     $httpResponseCode = $result->http_response_code;
     $httpResponseBody = $result->http_response_body;
     return $httpResponseBody;
 }
开发者ID:bernbuds,项目名称:website,代码行数:12,代码来源:Mailer.php

示例4: validateMailgun

 public function validateMailgun($attribute, $value, $parameters)
 {
     $mgClient = new Mailgun($value);
     try {
         $result = $mgClient->get("domains");
     } catch (\Mailgun\Connection\Exceptions\InvalidCredentials $e) {
         return false;
     } catch (GenericHTTPError $e) {
         return false;
     }
     return true;
 }
开发者ID:jeanfrancis,项目名称:faxbox,代码行数:12,代码来源:CustomLaravelValidator.php

示例5: find

 /**
  * @param int $id
  * @return CampaignStats
  */
 public function find($id)
 {
     $mg = new Mailgun($this->key);
     $result = $mg->get($this->domain . '/campaigns/' . $id);
     $stats = $result->http_response_body;
     $data['clicked'] = $stats->clicked_count;
     $data['opened'] = $stats->opened_count;
     $data['submitted'] = $stats->submitted_count;
     $data['unsubscribed'] = $stats->unsubscribed_count;
     $data['bounced'] = $stats->bounced_count;
     $data['delivered'] = $stats->delivered_count;
     $data['complained'] = $stats->complained_count;
     $data['dropped'] = $stats->dropped_count;
     return new CampaignStats($data);
 }
开发者ID:alistairshaw,项目名称:ambitiousmail-relay,代码行数:19,代码来源:MailgunCampaignStatsRepository.php

示例6: listremovememberAction

 public function listremovememberAction($listname, $address)
 {
     $mailgun = new Mailgun($this->private_key, $this->APIURL, "v3", true);
     $listAddress = $listname . $this->GROUPEMAIL;
     $listMember = '' . $address;
     $checkresult = $mailgun->get("lists", array('address' => '' . $listAddress));
     $decodedresult = json_decode(json_encode($checkresult), true);
     $count = $decodedresult['http_response_body']['total_count'];
     if ($count == 0) {
         $result = $this->listcreateAction($listname, ' the list ' . $listname, $address, ' ');
         if ($result['http_response_code'] != 200) {
             return $this->JsonResponse($result);
         }
     }
     $checkadress = $mailgun->get("lists/{$listAddress}/members", array('address' => '' . $address));
     $decodedresult = json_decode(json_encode($checkadress), true);
     $count = $decodedresult['http_response_body']['total_count'];
     if ($count > 0) {
         $result = $mailgun->delete("lists/{$listAddress}/members/{$listMember}");
     } else {
         $result = $this->listcreateAction($listname, 'new list ' . $listname, $address, ' ');
     }
     return $this->JsonResponse($result);
 }
开发者ID:austinpapp,项目名称:push-notifications-temp,代码行数:24,代码来源:MailgunApi.php

示例7: search

 /**
  * @param array $searchParams
  * @param int $limit
  * @param int $offset
  * @return Collection
  */
 public function search($searchParams, $limit = 0, $offset = 0)
 {
     $mg = new Mailgun($this->key);
     $apiParams['event'] = $searchParams['event'];
     if (isset($searchParams['recipient']) && $searchParams['recipient']) {
         $apiParams['recipient'] = $searchParams['recipient'];
     }
     if ($limit > 0) {
         $apiParams['limit'] = $limit;
     }
     if ($limit > 0) {
         $apiParams['page'] = $offset > 0 ? (int) ($offset / $limit) : 1;
     }
     $result = $mg->get($this->domain . '/campaigns/' . $searchParams['id'] . '/events', $apiParams);
     $final = [];
     foreach ($result->http_response_body as $event) {
         $recordArray = (array) $event;
         $final[] = $this->factory->create($recordArray);
     }
     return Collection::make($final);
 }
开发者ID:alistairshaw,项目名称:ambitiousmail-relay,代码行数:27,代码来源:MailgunCampaignEventRepository.php

示例8: postNews

 /**
  * @param Request $request
  *
  * @throws \Mailgun\Messages\Exceptions\MissingRequiredMIMEParameters
  */
 public function postNews(Request $request)
 {
     $mg = new Mailgun(config('services.mailgun.secret'));
     $mgValidate = new Mailgun(config('services.mailgun.public'));
     $domain = config('services.mailgun.domain');
     $mailingList = 'novidades@phpmga.net';
     $secretPassphrase = env('APP_KEY');
     $recipientAddress = $request->get('email');
     $result = $mgValidate->get('address/validate', array('address' => $recipientAddress));
     if ($result->http_response_body->is_valid == true) {
         # Next, instantiate an OptInHandler object from the SDK.
         $optInHandler = $mg->OptInHandler();
         # Next, generate a hash.
         $generatedHash = $optInHandler->generateHash($mailingList, $secretPassphrase, $recipientAddress);
         # Now, let's send a confirmation to the recipient with our link.
         $mg->sendMessage($domain, array('from' => config('services.mailgun.contact'), 'to' => $recipientAddress, 'subject' => 'Por favor confirme sua inscrição!', 'html' => "<html><body>Olá,<br><br>Você solicitou a inclusão de seu email em nossa lista\n                                                   {$mailingList}. Por favor <a\n                                                  href=\"http://{$domain}/email/confirm?hash={$generatedHash}\">\n                                                  confirme</a> sua inscrição.<br><br>Obrigado!</body></html>"));
         # Finally, let's add the subscriber to a Mailing List, as unsubscribed, so we can track non-conversions.
         if ($mg->post("lists/{$mailingList}/members", array('address' => $recipientAddress, 'subscribed' => 'no', 'upsert' => 'yes'))) {
             return Response::make(['success' => true]);
         }
     }
     return Response::make(['success' => false]);
 }
开发者ID:phpmga,项目名称:website,代码行数:28,代码来源:EmailController.php

示例9: array

}
$final = array();
$g = 0;
for ($i = 0; $i < sizeof($emails); $i++) {
    if (!isset($final[$g])) {
        $final += array($g => "");
    }
    if (strlen($final[$g] . $emails[$i] . ",") < 6000) {
        $final[$g] .= $emails[$i] . ",";
    } else {
        substr($final[$g], 0, -1);
        $g++;
    }
}
foreach ($final as $value) {
    $email_result = $mgClient->get("address/parse", array('addresses' => $value, 'syntax_only' => 'false'));
    foreach ($email_result->http_response_body->unparseable as $value) {
        $unparseable_address = $mgClient->get("address/validate", array('address' => $value));
        $didyoumean = $unparseable_address->http_response_body->did_you_mean;
        if (!empty($didyoumean)) {
            if ($conn->query("UPDATE emails SET email='{$didyoumean}' WHERE email='{$value}'") === TRUE) {
                echo "Updated: {$value} to {$didyoumean} <br>";
            } else {
                echo "Error updating record: " . $conn->error . "<br>";
            }
        } else {
            if ($conn->query("DELETE FROM emails WHERE email='{$value}' ") === TRUE) {
                echo "Deleted: {$value} <br>";
            } else {
                echo "Error deleting record: " . $conn->error . "<br>";
            }
开发者ID:balcsida,项目名称:ncorehuszar,代码行数:31,代码来源:check.php

示例10: check_list_for_member

 /**
  * Check a Mailgun list for an email address
  *
  * @since 1.0.0
  *
  * @param string $list_address The full address list to query.
  * @param string $address The email address to look for in $list_address.
  *
  * @return boolean
  */
 public function check_list_for_member($list_address, $address)
 {
     try {
         // Instantiate the client.
         $mg_client = new Mailgun(MAILGUN_API_KEY);
         // Issue the call to the client.
         $result = $mg_client->get("lists/{$list_address}/members/{$address}", array());
         $this->custom_log('check_list_for_member(): ' . $list_address . ' | ' . $address);
         return true;
     } catch (Exception $e) {
         $this->custom_log('Address ' . $address . ' does not exist in list ' . $list_address);
         return false;
     }
 }
开发者ID:mckernanin,项目名称:oa-tools,代码行数:24,代码来源:class-oa-tools-mailgun.php

示例11: Mailgun

<?php

require 'autoload.php';
use Mailgun\Mailgun;
$mgClient = new Mailgun('key-8bb667ef4a8fc33ed0b3ff93f666ba28');
$domain = 'service.tboopkjj88.com';
$result = $mgClient->get("{$domain}/stats/total", array('event' => array('accepted', 'delivered', 'failed'), 'duration' => '1m'));
//print_r($result);
print_r("------------><br/>");
$statu = 500;
$tempArr;
foreach ($result as $key => $value) {
    if ($key == "http_response_body") {
        $tempArr = $value;
    } else {
        if ($value == 200) {
            $statu = 200;
            print_r("<br/>Get data success!<br/>");
        }
    }
    //  print_r("<br/>---------><br/>");
    //  print_r($value);
    //  print_r("<br>----------><br/>");
}
if ($statu == 200) {
    foreach ($tempArr as $key => $value) {
        if ($key == "stats") {
            print_r($value[0]);
        }
    }
} else {
开发者ID:senlinsky,项目名称:PhpProject,代码行数:31,代码来源:stats.php

示例12: Mailgun

 function mg_get_subscriber($email)
 {
     $key = get_instance()->config->item('mailgun_key');
     $mg = new Mailgun($key);
     $list_address = get_instance()->config->item('newsletter_address');
     $res = $mg->get("lists/{$list_address}/members/{$email}");
 }
开发者ID:jatin-github,项目名称:psycho_store,代码行数:7,代码来源:mailgun_helper.php

示例13: subscribe

 /**
  *
  * Perform the subscription
  *
  */
 private function subscribe()
 {
     // First, instantiate the SDK with the API credentials, domain, and required parameters.
     $mg = new Mailgun($this->privateKey);
     $mgValidate = new Mailgun($this->publicKey);
     // Let's validate the customer's email address, using Mailgun's validation endpoint.
     $result = $mgValidate->get('address/validate', array('address' => $this->recipientAddress));
     if ($result->http_response_body->is_valid == true) {
         // Now, let's send a confirmation to the recipient with our link.
         $mg->sendMessage($this->domain, ['from' => $this->mailingList, 'to' => $this->recipientAddress, 'subject' => 'Thank You!', 'html' => "<html><body>Hello,<br><br>Thank you for subscribing to the " . $this->mailingList . " mailing list. We will let you know about any updates.</body></html>"]);
         // Finally, let's add the subscriber to a Mailing List.
         $mg->post("lists/" . $this->mailingList . "/members", ['address' => $this->recipientAddress, 'subscribed' => 'yes', 'upsert' => 'yes']);
     }
 }
开发者ID:adamtester,项目名称:subscribe-to-mailgun,代码行数:19,代码来源:index.php

示例14: generateOutput

  $response['log'].='|error: invalid email address: '.$sanitiedEmailString.'|';
}
*/
//$returnEmail=$_POST['returnEmail'];
//$contactFirstName=filter_var($_POST['contactFirstName'], FILTER_SANITIZE_STRING);
//echo '$contactFirstName='.$contactFirstName;
//echo '$contactFirstName:'.$contactFirstName;
$from = 'Moodoo Reminder Service <reminders@moodoo.net>';
$to = 'Moodoo Contact Officer <admin@moodoo.net>';
$subject = 'Reminder - update your Mood';
//$message=$_POST['contactMessage'];//filter_var($_POST['contactMessage'], FILTER_SANITIZE_STRING);
$html = '<html><head/><body><p>Hello John! Moodoo has successfully sent a cron message. Time is:' . date('Y-m-d') . '</p></body></html>';
//$text='Test text from script';
# Make the call to the client.
$result = $mgClient->sendMessage("{$domain}", array('from' => $from, 'to' => $to, 'subject' => $subject, 'html' => $html));
$result = $mgClient->get("{$domain}/log", array('limit' => 25, 'skip' => 0));
$httpResponseCode = $result->http_response_code;
$httpResponseBody = $result->http_response_body;
# Iterate through the results and echo the message IDs.
$logItems = $result->http_response_body->items;
foreach ($logItems as $logItem) {
    $response['log'] .= "|" . $logItem->message_id . "|";
}
function generateOutput()
{
    global $response;
    //generate json formatted response for client-side javascript use
    $response['log'] .= 'encoding json|';
    $print = json_encode($response);
    echo $print;
}
开发者ID:siriusrex,项目名称:Moodoo,代码行数:31,代码来源:moodoo_cron_mail.php

示例15: getDomainsFromMailgun

 public function getDomainsFromMailgun($mailgunKey)
 {
     $client = new Client();
     $mailgunClient = new Mailgun($mailgunKey, $client);
     return $mailgunClient->get('domains', ['limit' => 100, 'skip' => 0]);
 }
开发者ID:shockwave-design,项目名称:magento2-module-mail-mailgun,代码行数:6,代码来源:Domains.php


注:本文中的Mailgun\Mailgun::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。