Sends a SMS message.

@param \SimpleSoftwareIO\SMS\OutgoingMessage $message
485786
public function send(OutgoingMessage $message)
    {
        $composeMessage = $message->composeMessage();
        $from = $message->getFrom();

        foreach ($message->getTo() as $to) {
            $data = [
                'from'        => $from,
                'bulkVariant' => $this->getVariantForSender($from),
                'message'     => $composeMessage,
                'to'          => $to,
            ];

            $response = $this->sendRequest($data);

            if ($this->hasError($response)) {
                $this->handleError($response);
            }
        }
    }
273494
public function send(DestinationInterface $destination, MessageInterface $message)
    {
        InvalidDestinationException::assertDestinationInstanceOf($destination, DbalDestination::class);

        $body = $message->getBody();
        if (is_scalar($body) || is_null($body)) {
            $body = (string)$body;
        } else {
            throw new InvalidMessageException(sprintf(
                'The message body must be a scalar or null. Got: %s',
                is_object($body) ? get_class($body) : gettype($body)
            ));
        }

        $dbalMessage = [
            'body' => $body,
            'headers' => JSON::encode($message->getHeaders()),
            'properties' => JSON::encode($message->getProperties()),
            'priority' => $message->getPriority(),
            'queue' => $destination->getQueueName(),
        ];

        $delay = $message->getDelay();
        if ($delay) {
            if (! is_int($delay)) {
                throw new \LogicException(sprintf(
                    'Delay must be integer but got: "%s"',
                    is_object($delay) ? get_class($delay) : gettype($delay)
                ));
            }

            if ($delay <= 0) {
                throw new \LogicException(sprintf('Delay must be positive integer but got: "%s"', $delay));
            }

            $dbalMessage['delayed_until'] = time() + $delay;
        }

        try {
            $this->connection->getDBALConnection()->insert($this->connection->getTableName(), $dbalMessage, [
                'body' => Type::TEXT,
                'headers' => Type::TEXT,
                'properties' => Type::TEXT,
                'priority' => Type::SMALLINT,
                'queue' => Type::STRING,
                'delayed_until' => Type::INTEGER,
            ]);
        } catch (\Exception $e) {
            throw new Exception('The transport fails to send the message due to some internal error.', null, $e);
        }
    }
608077
public function send(OutgoingMessage $message)
    {
        try {
            $message = $this->mailer->send(['text' => $message->getView()], $message->getData(), function ($email) use ($message) {
                $this->generateMessage($email, $message);
            });
        } catch (InvalidArgumentException $e) {
            $message = $this->sendRaw($message);
        }

        return $message;
    }
734243
public function send(string $subject, string $message): void
    {
        $this->getMailer()
            ->send(
                $this->getMessage($subject, $message)
            )
        ;
    }
1240721
public function onMessageSendingToUsers(SendMessageEvent $event)
    {
        $message = $this->messageManager->create(
            $event->getContent(),
            $event->getObject(),
            $event->getUsers(),
            $event->getSender()
        );

        $this->messageManager->send($message);
    }
1251186
public function createSendContext(
        $message,
        SendOptions $options,
        PipelineStageContext $parentContext
    ) {
        return new OutgoingSendContext(
            new OutgoingLogicalMessage($message),
            $options,
            $parentContext instanceof IncomingContext ? $parentContext->getIncomingPhysicalMessage() : null,
            $parentContext instanceof IncomingContext ? $parentContext->getPendingTransportOperations() : null,
            $parentContext
        );
    }
749113
public function send(SmsMessage $message, $to)
    {

        $text = trim($message->content);
        if ($this->validate()) {
            return $this->push($to, $text);
        }

        return false;
    }
91180
public function send(Message $message) : void
    {
        header('Content-Type: text/xml', true);

        $xml = $this->getOutputToSend($message);
        if ($xml !== false) {
            Utils::getContainer()->debugMessage($xml, 'out');
            echo $xml;
        }

        // DOMDocument::saveXML() returned false. Something is seriously wrong here. Not much we can do.
        exit(0);
    }
71366
protected function success($message)
    {
        if ($this->isVerbose() === true) {
            $this->out("%g${message}%n", true);
        }
        
        exit(self::EXIT_SUCCESS);
    }
886694
public function handle(ReceiveMessage $message)
    {
        $typing = new Typing($message->getSender());
        $this->send($typing);
    }
657465
public function send(OutgoingMessage $message)
    {
        $from = $message->getFrom();
        $composeMessage = $message->composeMessage();

        //Convert to callfire format.
        $numbers = implode(',', $message->getTo());

        $data = [
            'from'       => $from,
            'to'         => $numbers,
            'text'       => $composeMessage,
            'api_key'    => $this->apiKey,
            'api_secret' => $this->apiSecret,
        ];

        $this->buildCall('/sms/json');
        $this->buildBody($data);

        $response = $this->postRequest();
        $body = json_decode($response->getBody(), true);
        if ($this->hasError($body)) {
            $this->handleError($body);
        }

        return $response;
    }
901149
public function send(QueueInterface $queue, Message $message)
    {
        $headers = $message->getHeaders();
        $properties = $message->getProperties();

        $headers['content_type'] = $message->getContentType();

        $transportMessage = $this->createTransportMessage();
        $transportMessage->setBody($message->getBody());
        $transportMessage->setHeaders($headers);
        $transportMessage->setProperties($properties);

        $transportMessage->setMessageId($message->getMessageId());
        $transportMessage->setTimestamp($message->getTimestamp());

        if ($message->getDelay()) {
            $transportMessage->setDelay($message->getDelay());
        }

        if ($message->getPriority()) {
            $this->setMessagePriority($transportMessage, $message->getPriority());
        }

        if ($message->getExpire()) {
            throw new \InvalidArgumentException('Expire is not supported by the transport');
        }

        $this->session->createProducer()->send($queue, $transportMessage);
    }
373127
public function sendMessage(Message $message)
    {
        $payload = $this->preparePayload($message);

        $encoded = json_encode($payload, JSON_UNESCAPED_UNICODE);

        if ($encoded === false) {
            throw new RuntimeException(sprintf('JSON encoding error %s: %s', json_last_error(), json_last_error_msg()));
        }

        $this->guzzle->post($this->endpoint, ['body' => $encoded]);
    }
801117
protected function sendRaw(OutgoingMessage $message)
    {
        $message = $this->mailer->raw($message->getView(), function ($email) use ($message) {
            $this->generateMessage($email, $message);
        });

        return $message;
    }
516523
public function send(Message $message)
    {
        $rawMessage = $this->getMessageEncoder()->encode($message);

        // test if we need to split the message to multiple chunks
        // chunkSize == 0 allows for an unlimited packet-size, and therefore
        // disables chunking
        if ($this->chunkSize && strlen($rawMessage) > $this->chunkSize) {
            return $this->sendMessageInChunks($rawMessage);
        }

        // send message in one packet
        $this->write($rawMessage);

        return 1;
    }
491420
public static function send($message)
    {
        if (is_array($message)) {
            $message = new Message($message);
        }

        return static::getMailer()->send($message->getOriginal());
    }
1302409
public function sendMessage(Message $message) {
        if ($this->isDisabled()) {
            return false;
        }

        $users = $message->getMyDestionationUsers($this->container);
        $sentCount = 0;
        foreach($users as $user) {
            //if($user->getId() != $message->getFromUser()->getId()){
            $sentCount += $this->sendMessageToUser($message, $user);
            //}
        }
        return $sentCount;
    }