Exemplo n.º 1
0
 /**
  * Create a new approved sender
  *
  * @param  Sender $sender
  * @return boolean
  */
 public function create(Sender $sender)
 {
     $params = array('emailaddress' => $sender->getEmailAddress());
     $response = $this->getApiClient()->post('/senders', $params);
     if ($response && $response->isOk()) {
         return true;
     }
     return false;
 }
Exemplo n.º 2
0
 /**
  * Get status of the sender and assign to provided instance of Sender
  *
  * @param Sender $sender
  * @return boolean
  */
 public function get(Sender $sender)
 {
     $params = array('emailaddress' => $sender->getEmailAddress());
     $response = $this->getApiClient()->get('/senders/status', $params);
     if ($response && $response->isOK()) {
         $sender->setIsReady((bool) $response->data->ready);
         return true;
     }
     return false;
 }
Exemplo n.º 3
0
 /**
  * Gets details for sender and writes it to the provided instance of Sender
  *
  * @param Sender $sender
  * @return boolean
  */
 public function get(Sender $sender)
 {
     $params = array('emailaddress' => $sender->getEmailAddress());
     $response = $this->getApiClient()->get('/senders/details', $params);
     if ($response && $response->isOK()) {
         $sender->setDetails($response->data);
         return true;
     }
     return false;
 }
Exemplo n.º 4
0
 /**
  * Create DKIM selector, optionally using the provided selector
  *
  * @param Sender $sender
  * @param string $dkimIdentifier Optional selector to assign to domain's DKIM
  * @return boolean
  */
 public function create(Sender $sender, $dkimIdentifier = false)
 {
     if (false === $dkimIdentifier) {
         $dkimIdentifier = uniqid();
     }
     $params = array('emailaddress' => $sender->getEmailAddress(), 'dkim' => $dkimIdentifier);
     // Assignment of a new selector should be rare and we're extremely likely
     // to want the public keys after, so we'll go ahead and refresh details which
     // which contain the DKIM records
     $response = $this->getApiClient()->post('/senders/dkim', $params);
     if ($response && $response->isOK()) {
         $details = new Details($this->getApiClient());
         $details->get($sender);
         return true;
     }
     return false;
 }