Esempio n. 1
0
 /**
  * @param array $message
  * @param array $files
  * @throws MissingRequiredMIMEParameters
  */
 public function sendMessage($message = array(), $files = array())
 {
     if (count($message) < 1) {
         $message = $this->message;
         $files = $this->files;
     }
     if (!array_key_exists("from", $message)) {
         throw new MissingRequiredMIMEParameters(ExceptionMessages::EXCEPTION_MISSING_REQUIRED_MIME_PARAMETERS);
     } elseif (!array_key_exists("to", $message)) {
         throw new MissingRequiredMIMEParameters(ExceptionMessages::EXCEPTION_MISSING_REQUIRED_MIME_PARAMETERS);
     } elseif (!array_key_exists("subject", $message)) {
         throw new MissingRequiredMIMEParameters(ExceptionMessages::EXCEPTION_MISSING_REQUIRED_MIME_PARAMETERS);
     } elseif (!array_key_exists("text", $message) && !array_key_exists("html", $message)) {
         throw new MissingRequiredMIMEParameters(ExceptionMessages::EXCEPTION_MISSING_REQUIRED_MIME_PARAMETERS);
     } else {
         $message["recipient-variables"] = json_encode($this->batchRecipientAttributes);
         $response = $this->restClient->post($this->endpointUrl, $message, $files);
         $this->batchRecipientAttributes = array();
         $this->counters['recipients']['to'] = 0;
         $this->counters['recipients']['cc'] = 0;
         $this->counters['recipients']['bcc'] = 0;
         unset($this->message["to"]);
         array_push($this->messageIds, $response->http_response_body->id);
     }
 }
Esempio n. 2
0
File: Mailgun.php Progetto: lhas/pep
 /**
  * @param boolean $sslEnabled
  *
  * @return Mailgun
  */
 public function setSslEnabled($sslEnabled)
 {
     $this->restClient->setSslEnabled($sslEnabled);
     return $this;
 }
Esempio n. 3
0
 /**
  * @param string $endpointUrl
  * @param array $putData
  * @return \stdClass
  */
 public function put($endpointUrl, $putData)
 {
     return $this->restClient->put($endpointUrl, $putData);
 }