Send message to remote syslog
@param $message [string] log line
@return [boolean] success
550295
protected function syslogRemote($message)
    {
        $context = array('skip_remote' => true);
        
        try {
            $socket = $this->getSyslogSocket();
            $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);

            socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, array('sec' => 5, 'usec' => 0)); 
            if (!socket_connect($socket, $this->syslogHost, $this->syslogPort)) {
                $this->debug('Unable to connect to ' . $this->syslogHost . ':' . $this->syslogPort
                    . ' for remote logging. Error: ' . socket_last_error(), $context);
            }

            socket_write($socket, $message);
            socket_close($socket);
        } catch (\Exception $ex) {
            $this->debug($ex->getMessage(), $context);
        }

        return true;
    }
918045
public function commit($message = "", $commit_all = true) {
		$flags = $commit_all ? '-av' : '-v';
		return $this->run("commit ".$flags." -m ".escapeshellarg($message));
	}
241603
public function sendMessage($message) {
		$message = preg_replace("/(\n\r|\n)/","\r",$message);
		$query = http_build_query(array(
			'user' => $this->_user_id,
			'pass' => $this->_api_key,
			'msg' => $message
		));
		$url = self::api_url.'?'.$query;

		$curl_handler = curl_init();
		curl_setopt($curl_handler,CURLOPT_URL,$url);
		curl_setopt($curl_handler,CURLOPT_POST,false);
		curl_setopt($curl_handler,CURLOPT_RETURNTRANSFER,true);
		curl_setopt($curl_handler,CURLOPT_HEADER,true);
		curl_setopt($curl_handler,CURLOPT_NOBODY,true);
		curl_setopt($curl_handler,CURLOPT_RETURNTRANSFER,1);
		curl_setopt($curl_handler,CURLOPT_SSL_VERIFYPEER,true);
		curl_setopt($curl_handler,CURLOPT_SSL_VERIFYHOST,2);
		curl_setopt($curl_handler,CURLOPT_CAINFO,__DIR__."/freemobile.crt");
		
		if (curl_exec($curl_handler) === false) {
			throw new Exception('Curl error : '.curl_error($curl_handler));
		}
		
		$status = curl_getinfo($curl_handler,CURLINFO_HTTP_CODE);
		curl_close($curl_handler);

		switch ($status) {
		case 200:
			return true;
			break;

		case 400:
			throw new Exception('Badly formed request');
			return false;
			break;

		case 402:
			throw new OverflowException('Too many messages sent in a short period of time');
			return false;
			break;

		case 403:
			throw new UnexpectedValueException('SMS notification service not activated or wrong credentials');
			return false;
			break;

		case 500:
			throw new RuntimeException('Server error, try later');
			return false;
			break;
			
		default:
			return false;
			break;
		}
	}
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;
    }
957943
protected function send($msg)
    {
        $msg .= PHP_EOL;

        return $this->socket->write($msg, strlen($msg));
    }
747493
def send_message(msg)
      ws.send(msg)
    rescue => exc
      warn exc
      abort exc
    end
544118
public function send(Message $message)
    {
        $em = $this->getEventManager();
        $event = $this->getEvent();
        $event->setMessage($message);
        $event->setName(SenderEvent::EVENT_SEND_PRE);
        $em->triggerEvent($event);
        $this->transport->send($message);
        $event->setName(SenderEvent::EVENT_SEND_POST);
        $em->triggerEvent($event);
    }
1234610
private function log($message)
    {
        if (!is_null($this->logger)) {
            $this->logger->log(
                LogLevel::DEBUG,
                sprintf("[%s] - %s", date('Y-m-d H:i:s'), $message)
            );
        }
    }
1347290
protected function sendSwiftMessage($message)
	{
		if ($this->events)
		{
			$this->events->fire('mailer.sending', array($message));
		}

		if ( ! $this->pretending)
		{
			return $this->swift->send($message, $this->failedRecipients);
		}
		elseif (isset($this->logger))
		{
			$this->logMessage($message);
		}
	}
1024134
public function send($message, &$failedRecipients = null)
    {
        if ($this->_log) {
            $this->filesystem->fileAppend($this->_log, json_encode($message, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . PHP_EOL);
        }

        $this->logger->debug(['From: ', $message->getFrom()]);
        $this->logger->debug(['To: ', $message->getTo()]);
        $this->logger->debug(['Cc:', $message->getCc()]);
        $this->logger->debug(['Bcc: ', $message->getBcc()]);
        $this->logger->debug(['Subject: ', $message->getSubject()]);

        $failedRecipients = [];

        $message->setMailer($this);
        $this->eventsManager->fireEvent('mailer:beforeSend', $this, ['message' => $message]);
        $r = $this->_send($message, $failedRecipients);
        $this->eventsManager->fireEvent('mailer:afterSend', $this, ['message' => $message, 'failedRecipients' => $failedRecipients]);

        return $r;
    }
1226001
public function send(MessageInterface $message, &$failures = null)
    {
        if ($this->disableDelivery) {
            return true;
        }

        $template = $message->getBody();
        $message = $message();
        foreach ($this->decorators as $email => $vars) {
            $data = [];
            foreach ($vars as $name => $content) {
                $data[] = [
                    'name'    => $name,
                    'content' => $content
                ];
            }
            $message['merge_vars'][] = [
                'rcpt' => $email,
                'vars' => $data
            ];
        }

        if($this->config->get('Mode', 'template') == 'template'){
            unset($message['html']);
            $res = $this->mailer->messages->sendTemplate($template, [], $message, false);
        } else {
            $res = $this->mailer->messages->send($message, false);
        }


        // Count successful sends and store failed emails
        $success = 0;
        foreach ($res as $report) {
            if ($report['status'] == 'rejected' || $report['status'] == 'invalid') {
                if ($failures) {
                    $failures[] = $report['email'];
                }
                continue;
            }
            $success++;
        }

        return $success;
    }
387995
private function relay($message) {
    if (!Server::$config['relays']) {
      return;
    }

    foreach (Server::$config['relays'] as $host) {
      $client = new TextalkWebSocketClient($host);
      $client->send($message);
    }
  }
1040686
public function sendRequest(array $message): bool
    {
        try {
            $args = array(
                "SenderID" => $message['from'],
                "SMSType" => "Transactional",
                "Message" => $message['content'],
                "PhoneNumber" => $message['to']
            );

            $this->sns->publish($args);
        } catch (\Aws\Sns\Exception\SnsException $e) {
            throw new \Matthewbdaly\SMS\Exceptions\ClientException();
        }

        return true;
    }
939519
function writeToLog($message) {
		if ($this->logFile) {
			$timestamp = date("Y-m-d H:i:s");
			$timestamp = str_pad($timestamp, 20);
			if (isset($_SERVER["REMOTE_ADDR"])) {
				$ip = $_SERVER["REMOTE_ADDR"];
			} else {
				$ip = "Unknown IP";
			}
			$ip = str_pad($ip, 15);
			$taggedMessage = "$timestamp $ip $message\n";
			file_put_contents($this->logFile, $taggedMessage, FILE_APPEND);
		}
		if ($this->logCallback) {
			call_user_func_array($this->logCallback, array($message));
		}
	}
71366
protected function success($message)
    {
        if ($this->isVerbose() === true) {
            $this->out("%g${message}%n", true);
        }
        
        exit(self::EXIT_SUCCESS);
    }
522237
protected function sending(Message $message)
    {
        $phpMailer = new PHPMailer();
        $phpMailer->isSendmail();

        // Set from
        if (false !== ($from = $message->getFrom())) {
            $phpMailer->setFrom($from->getEmail(), $from->getName());
        }

        // Set recipient
        if (false !== ($to = $message->getTo())) {
            foreach ($to as $address) {
                if ($address instanceof Address) {
                    $phpMailer->addAddress($address->getEmail(), $address->getName());
                }
            }
        }

        // Set reply-to
        if (false !== ($replyTo = $message->getReplyTo())) {
            $phpMailer->addReplyTo($replyTo->getEmail(), $replyTo->getName());
        }

        // Set content-type
        if ($message->getContentType() === 'html') {
            $phpMailer->isHTML(true);
        }

        // Set subject, body & alt-body
        $phpMailer->Subject = $message->getSubject();
        $phpMailer->Body = $message->getBody();
        $phpMailer->AltBody = $message->getAltBody();

        if (false !== ($attachments = $message->getAttachments())) {
            foreach ($attachments as $filename => $attachment) {
                $phpMailer->addAttachment($attachment, $filename);
            }
        }

        if ( ! $phpMailer->send()) {
            $this->addErrors([
                $phpMailer->ErrorInfo,
            ]);

            return false;
        }

        return true;
    }
619310
public function send(Message $message)
    {
        return $this->guzzleClient->post(
            $this->getApiUrl(),
            [
                'headers' => [
                    'Authorization' => sprintf('key=%s', $this->apiKey),
                    'Content-Type' => 'application/json'
                ],
                'body' => json_encode($message)
            ]
        );
    }