Sends a C2DM message
This assumes that a valid auth token can be obtained

@param  \RMS\PushNotificationsBundle\Message\MessageInterface              $message
@throws \RMS\PushNotificationsBundle\Exception\InvalidMessageTypeException
@return bool
332416
public function send(MessageInterface $message)
    {
        if (!$message instanceof AndroidMessage) {
            throw new InvalidMessageTypeException(sprintf("Message type '%s' not supported by C2DM", get_class($message)));
        }

        if ($this->getAuthToken()) {
            $headers[] = "Authorization: GoogleLogin auth=" . $this->authToken;
            $data = $message->getMessageBody();

            $buzz = new Browser();
            $buzz->getClient()->setVerifyPeer(false);
            $buzz->getClient()->setTimeout($this->timeout);
            $response = $buzz->post("https://android.apis.google.com/c2dm/send", $headers, http_build_query($data));

            return preg_match("/^id=/", $response->getContent()) > 0;
        }

        return false;
    }
376626
public function checkMessage(MessageInterface $message) {
        if (!$message->isBinary()) {
            if (!$this->checkUtf8($message->getPayload())) {
                return Frame::CLOSE_BAD_PAYLOAD;
            }
        }

        return true;
    }
598689
public function publish($message) {
		if ($this->name === null) {
			throw new InvalidConfigException(get_class($this)." requires a name!");
		}
		$this->_data[] = $message;
		return $this->getConnection()->getClient()->publish($this->name,$message);
	}
857664
public function push(Message $message)
    {
        $profilingEvent = $this->clientProfiler->startProfiling(sprintf('GcmClient::push(%s)', $message->getPayloadAsJson()));

        try {
            parent::push($message);

            $this->clientProfiler->stopProfiling($profilingEvent, array(
                'error' => false,
                'error_message' => null,
            ));

        } catch (\Exception $e) {
            $this->clientProfiler->stopProfiling($profilingEvent, array(
                'error' => true,
                'error_message' => $e->getMessage(),
            ));

            throw $e;
        }
    }
855098
public function send(Mail\Message $message)
    {
        $this->getMandrillClient();

        $body = $message->getBody();
        $attachments = [];

        switch (true) {
            case $body instanceof Message:
                $bodyHtml = $this->getHtmlPart($body);
                $bodyText = $this->getTextPart($body);
                $attachments = $this->getAttachments($body);
                break;
            case is_string($body):
                $bodyHtml = $body;
                $bodyText = $message->getBodyText();
                break;
            case is_object($body):
                $bodyHtml = $body->__toString();
                $bodyText = $message->getBodyText();
                break;
            default:
                throw new Exception\InvalidArgumentException(
                    sprintf(
                        '"%s" expectes a body that is a string, an object or a Zend\Mime\Message; received "%s"',
                        __METHOD__,
                        is_object($body) ? get_class($body) : gettype($body)
                    )
                );
                break;
        }

        $message = [
            'html' => $bodyHtml,
            'text' => $bodyText,
            'subject' => $message->getSubject(),
            'from_email' => $message->getFrom()->current()->getEmail(),
            'from_name' => $message->getFrom()->current()->getName(),
            'to' => array_merge(
                $this->mapAddressListToArray($message->getTo(), 'to'),
                $this->mapAddressListToArray($message->getCc(), 'cc'),
                $this->mapAddressListToArray($message->getBcc(), 'bcc')
            ),
            'headers' => $message->getHeaders()->toArray(),
            'subaccount' => $this->options->getSubAccount(),
            'attachments' => $attachments
        ];

        return $this->mandrillClient->messages->send($message);
    }
312587
public function Send($deviceToken, $message, $method = "HTTP")
	{
		$output = new stdClass();
		$output->date = date('Y-m-d H:i:s');

		// TODO: add in CCS with XMPP services alongside of the vanilla HTTP
		if ($method == "HTTP")
		{
			$fields = array(
				'registration_ids' => array($deviceToken),
				'data' => array("message" => $message)
			);

			$headers = array(
				'Authorization: key=' . $this->googlePushRegistrationId,
				'Content-Type: application/json'
			);

			// Open connection
			$ch = curl_init();

			curl_setopt($ch, CURLOPT_URL, $this->gatewayUrl);
			curl_setopt($ch, CURLOPT_POST, true);
			curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

			// Disabling SSL Certificate support temporarily
			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));

			// Execute post
			$result = curl_exec($ch);

			if ($result === FALSE)
			{
				$output->success = false;
				$output->message = 'Communication Error: Unable to deliver message';
			}
			else
			{
				$output->success = true;
				$output->message = print_r($result,1);
			}

			curl_close($ch);
		}

		return $output;
	}
29381
public function send(Message $message)
    {
        if (empty($message->getTo()) || empty($message->getSubject()) || empty($message->getMessage())) {
            throw new InvalidArgumentException(
                "An error has occurred. The sender or the message or object omits.",
                E_USER_ERROR
            );
        }

        if (isset($this->config['mail'])) {
            $section = $this->config['mail']['default'];

            if (!$message->fromIsDefined()) {
                $form = $this->config['mail'][$section];

                $message->from($form["address"], $form["username"]);
            } elseif (!Str::isMail($message->getFrom())) {
                $form = $this->config['mail'][$message->getFrom()];

                $message->from($form["address"], $form["username"]);
            }
        }

        $to = '';

        $message->setDefaultHeader();

        foreach ($message->getTo() as $value) {
            if ($value[0] !== null) {
                $to .= $value[0] . ' <' . $value[1] . '>';
            } else {
                $to .= '<' . $value[1] . '>';
            }
        }

        $headers = $message->compileHeaders();

        $headers .= 'Content-Type: ' . $message->getType() . '; charset=' . $message->getCharset() . Message::END;

        $headers .= 'Content-Transfer-Encoding: 8bit' . Message::END;

        // Send email use the php native function
        $status = @mail($to, $message->getSubject(), $message->getMessage(), $headers);

        return (bool) $status;
    }
1290649
public function sendUserMessage($id, $message, $type = 'popup_chat')
    {
        if ($this->isEmptyId($id)) {
            throw new InvalidArgumentException;
        }

        if (!$message) {
            throw new InvalidArgumentException;
        }

        if (!in_array($type, ['popup_chat', 'popup_small', 'popup_big', 'email'])) {
            throw new InvalidArgumentException;
        }

        $params = [
            'body' => $message,
            'type' => $type
        ];
        $res = $this->call('users/' . $id . '/sendmessage', $params, 'post');

        if ($res) {
            return true;
        }

        return false;
    }
303140
public function send(Message $message)
    {
        $protocolClass = '\O2System\Email\Protocols\\' . ucfirst($this->config->offsetGet('protocol')) . 'Protocol';

        if (class_exists($protocolClass)) {
            $protocol = new $protocolClass($this);

            if ($protocol instanceof AbstractProtocol) {
                return $protocol->send($message);
            }
        }

        return false;
    }
432271
public function send(MessageInterface $message, $skipErrors = true) {

        $mobitex = $this->getClient();
        
        foreach ($message->getRecipient() as $recipient) {
            try {
                $mobitex->sendMessage($recipient, $message->getText());
            }
            catch (Exception $e) {
                $this->addError(new SendingError($recipient, $e->getCode(), $e->getMessage()));
                if (!$skipErrors) {
                    throw new \RuntimeException($e->getMessage(), $e->getCode());
                }
            }
        }
        return $this->getErrors()->count() === 0;
    }
568182
public function send(Message $message)
	{
		// Queue the message and flush the associated gateway
		$messageEnvelope = $this->queue($message);
		$this->flush( $message->getCertificate() );

		// Return the envelope
		return $messageEnvelope;
	}
692290
public function passesAuthorization(MessageReceived $message): bool
    {
        if (method_exists($this, 'authorize')) {
            return $this->authorize($message);
        }

        return true;
    }
1316405
protected function sendSwiftMessage($message)
    {
        try {
            return $this->swift->send($message, $this->failedRecipients);
        } finally {
            $this->forceReconnection();
        }
    }
531568
public function sendMessage(string $message) : ?Message 
    {
        $thread = $this->messageGroup();

        if ($thread === null) return null;

        return $thread->sendMessage($message);
    }
262536
public function send(ShortMessageInterface $message)
    {
        foreach ($this->transports as $priority => $transports) {
            foreach ($transports as $transport) {
                $result = false;
                try {
                    $result = $transport->send($message);
                } catch (DeliveryFailedException $exception) {
                    if ($this->logger) {
                        $this->logger->warning($exception->getMessage());
                    }
                }

                if ($result === true) {
                    return true;
                }
            }
        }

        if ($this->logger) {
            $this->logger->error(
                'All transports failed or empty transport list',
                array('count' => count($this->transports, COUNT_RECURSIVE))
            );
        }

        return false;
    }
1099585
public function send(Message $message)
    {
        /* @var AppleMessage $message */
        $buildMessage = $this->buildMessage($message);
        $this->streamSocket->connect();
        $bytesSend = $this->streamSocket->write($buildMessage);
        if (strlen($buildMessage) !== $bytesSend) {
            $this->streamSocket->disconnect();
            throw new ConnectionExceptionImpl();
        }
        usleep(self::SEND_INTERVAL);
    }
15749
public function send($message = null)
    {
        if ($message) {
            $this->message($message);
        }

        if (empty($this->message)) {
            throw new RuntimeException('No message to send.');
        }

        if (is_null($this->agentId)) {
            throw new RuntimeException('No agentid specified.');
        }

        $message = $this->message->transformForJsonRequest(array_merge([
            'agentid' => $this->agentId,
            'safe' => intval($this->secretive),
        ], $this->to));

        $this->secretive = false;

        return $this->client->send($message);
    }