/**
  * Send an email via the Gmail API
  *
  * Uses URI https://www.googleapis.com
  *
  *
  * @return void
  * @todo Rename this to sendMail, it's a public method...
  */
 public function _sendMail()
 {
     // Prepare the message in message/rfc822
     $message = $this->header . Postman_Zend_Mime::LINEEND . $this->body;
     $this->message = $message;
     $this->logger->trace('message: ' . $message);
     // The message needs to be encoded in Base64URL
     $mime = rtrim(strtr(base64_encode($message), '+/', '-_'), '=');
     $msg = new Postman_Google_Service_Gmail_Message();
     $msg->setRaw($mime);
     $service = $this->_config[self::SERVICE_OPTION];
     $service->users_messages->send('me', $msg);
 }
 /**
  * Send an email via the Gmail API
  *
  * Uses URI https://www.googleapis.com
  *
  *
  * @return void
  * @todo Rename this to sendMail, it's a public method...
  */
 public function _sendMail()
 {
     // Prepare the message in message/rfc822
     $message = $this->header . Postman_Zend_Mime::LINEEND . $this->body;
     $this->message = $message;
     // The message needs to be encoded in Base64URL
     $encodedMessage = rtrim(strtr(base64_encode($message), '+/', '-_'), '=');
     $googleApiMessage = new Postman_Google_Service_Gmail_Message();
     $googleApiMessage->setRaw($encodedMessage);
     $googleService = $this->_config[self::SERVICE_OPTION];
     $result = array();
     try {
         $result = $googleService->users_messages->send('me', $googleApiMessage);
         if ($this->logger->isInfo()) {
             $this->logger->info(sprintf('Message %d accepted for delivery', PostmanState::getInstance()->getSuccessfulDeliveries() + 1));
         }
         $this->transcript = print_r($result, true);
         $this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS;
         $this->transcript .= $message;
     } catch (Exception $e) {
         $this->transcript = $e->getMessage();
         $this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS;
         $this->transcript .= $message;
         throw $e;
     }
 }