Send a notification.

@param string $to
@param string $message

@return \NotifyMeHQ\Contracts\ResponseInterface
343570
public function notify($to, $message)
    {
        $params = [
            'UN'      => Arr::get($this->config, 'username', ''),
            'PW'      => Arr::get($this->config, 'password', ''),
            'O'       => urlencode(Arr::get($this->config, 'sender', '')),
            'D'       => Arr::get($this->config, 'D', $to),
            'LONGSMS' => Arr::get($this->config, 'LONGSMS', ''),
            'M'       => $message,
        ];

        return $this->send($this->buildUrlFromString('http/get/SendSms.php'), array_filter($params));
    }
1370157
public function dispatch(MessageInterface $message)
    {
        $builder = $this->notificationBuilder;

        $notifications = $builder->buildNotifications($message);

        /** @var Notification $notification */
        foreach ($notifications as $notification) {
            $this->sendNotification($notification);
        }

        return $this;
    }
1180424
public static function sendSimple($to, string $subject, string $message) : array {
		return self::send(['to' => $to, 'subject' => $subject, 'message' => $message]);
	}
823250
public function notify($to, $message)
    {
        $params = [
            'to'          => $to,
            'service_key' => $this->config['token'],
            'event_type'  => Arr::get($this->config, 'event_type', 'trigger'),
            'client'      => Arr::get($this->config, 'client', null),
            'client_url'  => Arr::get($this->config, 'client_url', null),
            'details'     => Arr::get($this->config, 'details', null),
            'description' => $message,
        ];

        return $this->send($this->buildUrlFromString('create_event.json'), $params);
    }
427118
protected function addNotification($message)
    {
        $event = new NotificationEvent();
        $event->setMessage($message);
        
        $this
            ->eventDispatcher
            ->dispatch(NotificationEvent::NAME, $event)
        ;
    }
1176359
protected function buildReply($to, $from, $message)
    {
        $base = [
            'ToUserName'   => $to,
            'FromUserName' => $from,
            'CreateTime'   => time(),
            'MsgType'      => is_array($message) ? current($message)->getType() : $message->getType(),
        ];

        $transformer = new Transformer();

        return XML::build(array_merge($base, $transformer->transform($message)));
    }
320603
public function setMessage(NotificationInterface $notification, $message, $flush = false)
    {
        $notification->setMessage($message);
        $this->flush($flush);

        $event = new NotificationEvent($notification);
        $this->dispatcher->dispatch(MgiletNotificationEvents::MODIFIED, $event);

        return $notification;
    }
1319880
public function call(Message $message) : Message
    {
        $aggregate = $message->getHeaders()->containsKey(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_HEADER)
                            ? $message->getHeaders()->get(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_HEADER)
                            : null;
        $methodInvoker = MethodInvoker::createWith(
            $aggregate ? $aggregate : $message->getHeaders()->get(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_CLASS_NAME_HEADER),
            $message->getHeaders()->get(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_METHOD_HEADER),
            $this->messageToParameterConverters
        );

        $resultMessage = MessageBuilder::fromMessage($message);
        try {
            $result = $methodInvoker->processMessage($message);

            if (!$aggregate) {
                $resultMessage = $resultMessage
                    ->setHeader(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_HEADER, $result);
            }
        } catch (\Throwable $e) {
            throw MessageHandlingException::fromOtherException($e, $message);
        }

        if (!is_null($result)) {
            $resultMessage = $resultMessage
                ->setPayload($result);
        }

        return $resultMessage
                ->build();
    }
42333
public function send($notifiable, Notification $notification)
    {
        if (!$to = $notifiable->routeNotificationFor('SMS')) {
            return;
        }

        $message = $notification->toSMS($notifiable);
        if (is_string($message)) {
            $message = new SMSMessage($message);
        }

        $this->SMSManager
            ->channel($message->channel)
            ->send($to, $message->content);
    }
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;
	}
466359
public function sendPresenceSubscription($to)
    {
        $node = new ProtocolNode('presence', ['type' => 'subscribe', 'to' => $this->getJID($to)], null, '');
        $this->sendNode($node);
    }
1363344
protected function _send($message)
    {
        $options = [
            'headers' => ['Authorization' => 'Bearer ' . $this->getConfig('api_key')]
        ];
        $response = $this->http->post('/api/mail.send.json', $message, $options);
        if ($response->getStatusCode() !== 200) {
            throw new SendgridEmailException(sprintf(
                'SendGrid error %s %s: %s',
                $response->getStatusCode(),
                $response->getReasonPhrase(),
                implode('; ', $response->json['errors'])
            ));
        }

        return $response->json;
    }
214827
public function send($to)
    {
        $this->params['content'] = sprintf(
            "[%s] to: %s, message: \"%s\", data: %s\n",
            date('Y-m-d H:i:s'),
            $to,
            addcslashes($this->params['content'], '"'),
            json_encode($this->params)
        );
        return error_log($this->params['content'], 3, Config::get('file', ini_get('error_log')));
    }
125597
public function sendMessage(Message $message)
    {
        $this->currentId++;
        $messageData = $message->convertToRconData($this->currentId);
        $this->client->write($messageData);

        return $this->getResponseMessage();
    }
742896
protected function makeCall(TwilioCallMessage $message, $to)
    {
        $params = [
            'url' => trim($message->content),
        ];

        $this->fillOptionalParams($params, $message, [
            'statusCallback',
            'statusCallbackMethod',
            'method',
            'status',
            'fallbackUrl',
            'fallbackMethod',
        ]);

        if (! $from = $this->getFrom($message)) {
            throw CouldNotSendNotification::missingFrom();
        }

        return $this->twilioService->calls->create(
            $to,
            $from,
            $params
        );
    }
1368763
public function respondWithMessage($message = "Ok")
    {
        $data = $this->getResponseStructure(true, null, $message);

        return $this->respond($data);
    }
1087876
public function sendSMTP($to, $from, $message)
    {
        $host = __config()->email->smtp_host;
        $user = __config()->email->smtp_user;
        $pass = __config()->email->smtp_pass;
        $port = __config()->email->smtp_port;
        if ($h = fsockopen($host, $port)) {
            $data = [
                0,
                "EHLO $host",
                'AUTH LOGIN',
                base64_encode($user),
                base64_encode($pass),
                "MAIL FROM: <$from>",
                "RCPT TO: <$to>",
                'DATA',
                $message,
            ];
            foreach ($data as $c) {
                $c && fwrite($h, "$c\r\n");
                while (substr(fgets($h, 256), 3, 1) != ' ') {
                }
            }
            fwrite($h, "QUIT\r\n");

            return fclose($h);
        }
    }