當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Mailgun::put方法代碼示例

本文整理匯總了PHP中Mailgun\Mailgun::put方法的典型用法代碼示例。如果您正苦於以下問題:PHP Mailgun::put方法的具體用法?PHP Mailgun::put怎麽用?PHP Mailgun::put使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mailgun\Mailgun的用法示例。


在下文中一共展示了Mailgun::put方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getConfirm

 /**
  * @param Request $request
  *
  * @throws \Mailgun\Messages\Exceptions\MissingRequiredMIMEParameters
  */
 public function getConfirm(Request $request)
 {
     $mg = new Mailgun(config('services.mailgun.secret'));
     $domain = config('services.mailgun.domain');
     $optInHandler = $mg->OptInHandler();
     $inboundHash = $request->get('hash');
     $secretPassphrase = env('APP_KEY');
     $hashValidation = $optInHandler->validateHash($secretPassphrase, $inboundHash);
     if ($hashValidation) {
         $validatedList = $hashValidation['mailingList'];
         $validatedRecipient = $hashValidation['recipientAddress'];
         $body = "<html><body>Olá,<br><br>Adicionamos seu email na nossa lista, {$validatedList}!<br><br>Obrigado!</body></html>";
         $mg->put("lists/{$validatedList}/members/{$validatedRecipient}", array('address' => $validatedRecipient, 'subscribed' => 'yes'));
         $mg->sendMessage($domain, array('from' => config('services.mailgun.contact'), 'to' => $validatedRecipient, 'subject' => 'Confirmado!', 'html' => $body));
         return Response::make($body);
     }
     return Response::make("N&atilde;o foi poss&iacute;vel confirmar sua inscri&ccedil;&atilde;o, tente novamente mais tarde.");
 }
開發者ID:phpmga,項目名稱:website,代碼行數:23,代碼來源:EmailController.php

示例2: Mailgun

 function mg_unsubscribe($email_id)
 {
     $key = get_instance()->config->item('mailgun_key');
     $mg = new Mailgun($key);
     $list_address = get_instance()->config->item('newsletter_address');
     # Issue the call to the client.
     $result = $mg->put("lists/{$list_address}/members", array('address' => $email_id, 'subscribed' => 'no'));
 }
開發者ID:jatin-github,項目名稱:psycho_store,代碼行數:8,代碼來源:mailgun_helper.php


注:本文中的Mailgun\Mailgun::put方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。