Sends email in order to send text message

@param string $to
@param string $subject
@param string $message

@return int
555520
private function _mail($to, $subject, $message)
		{
			// Set up swift mailer if needed
			if (!$this->_mailer) {
				$transport = NULL;
				// Set transport to php
				if (strtolower($this->transportType) == 'php') {
					$transport = Swift_MailTransport::newInstance();
				} // Set transport to smtp
				elseif (strtolower($this->transportType) == 'smtp') {
					$transport = \Swift_SmtpTransport::newInstance();

					foreach ($this->transportOptions as $option => $value) {
						$methodName = 'set' . ucfirst($option);
						$transport->$methodName($value);
					}
				}

				// Create Mailer object
				$this->_mailer = \Swift_Mailer::newInstance($transport);
			}

			// Set up message
			$mailer  = $this->_mailer;
			$message = Swift_Message::newInstance($subject)->setFrom('not@used.com')->setTo($to)->setBody($message);

			return $mailer->send($message);
		}
756232
public static Intent sendEmail(String to, String subject, String text) {
        return sendEmail(new String[]{to}, subject, text);
    }
1103126
private function sendTo(Swift_Mime_SimpleMessage $message, $reversePath, array $to, array &$failedRecipients)
    {
        if (empty($to)) {
            return 0;
        }

        return $this->doMailTransaction($message, $reversePath, array_keys($to),
            $failedRecipients);
    }
841353
public function message($to, $message)
    {
        $this->logger->info(sprintf('Sending a message ["%s"] to %s', $message, $to));

        return call_user_func_array([$this->wrapped, 'message'], func_get_args());
    }
1005919
public function send(?string $message = null, ?string $subject = null)
  {
    if ($message != null) {
      $this->body = $message;
    }

    if ($subject != null) {
      $this->subject = $subject;
    }

    if ($this->viewLocation != null || $this->viewLocation !== '') {
      $this->render($this->viewLocation, $this->viewArgs);
    }

    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->SMTPDebug = 0;
    $mail->SMTPAuth = true;
    $mail->SMTPSecure = $this->connection['encryption'];
    $mail->SMTPKeepAlive = true;
    $mail->Host = $this->connection['host'];
    $mail->Port = $this->connection['port'];
    $mail->IsHTML(true);
    $mail->Username = $this->connection['username'];
    $mail->Password = $this->connection['password'];

    $mail->SetFrom($this->connection['from']['address'], $this->connection['from']['name']);

    $mail->Subject = $this->subject;
    $mail->Body = $this->outputdata == null ? $this->body : $this->outputdata;

    if ($this->replyTo != null) {
      $mail->addReplyTo($this->replyTo['email'], $this->replyTo['name']);
    }

    if ($this->to != null) {
      foreach($this->to as $email) {
        $mail->AddAddress($email['email'], $email['name']);
      }
    }

    if ($this->bcc != null) {
      foreach($this->bcc as $email) {
        $mail->addBCC($email['email'], $email['name']);
      }
    }

    if ($this->cc != null) {
      foreach($this->cc as $email) {
        $mail->addCC($email['email'], $email['name']);
      }
    }

    if ($this->attachment != null) {
      foreach($this->attachment as $attachment) {
        $mail->addAttachment($attachment['file'], $attachment['name']);
      }
    }

    if(!$mail->Send()) {
      return ["status" => "failed", "reason" => $mail->ErrorInfo];
    }

    return ["status" => "success"];
  }
1344110
public static function send(string $to, string $subject, string $view, array $viewVars = [], $builder = null, $from = 'default')
    {
        $message = static::createMessage($to, $subject, $from);
        if (is_callable($builder)) {
            $builder($message);
        }
        $message->setBody(static::view($view, $viewVars));

        self::getMailer()->send($message);
    }
1012497
public function send($to, $subject, $body, $headers)
    {
        return mail(
            $to,
            $subject,
            $body,
            $headers
        );
    }
257026
public function send($from, $fromName, $to, $toName, $subject, $content)
    {
        $transport = Swift_SmtpTransport::newInstance($this->smtp, $this->port)
            ->setUsername($this->username)
            ->setPassword($this->password);
        $mailer = Swift_Mailer::newInstance($transport);
//        $logger = new Swift_Plugins_Loggers_EchoLogger();
//        $mailer->registerPlugin(new Swift_Plugins_LoggerPlugin($logger));
        $message = Swift_Message::newInstance();
        $message->setEncoder(Swift_Encoding::get8BitEncoding())
            ->setSubject($subject)
            ->setFrom(array($from => $fromName))
            ->setTo(array($to => $toName))
            ->setBody($content, 'text/html');
//        $message->toString();
//        $logger->dump();
        $result = $mailer->send($message);
        return $result;
    }
311917
protected function sendEmailNotification($subject, $message)
    {
        $superUsers = UsersManagerApi::getInstance()->getUsersHavingSuperUserAccess();

        foreach ($superUsers as $superUser) {
            $mail = new Mail();
            $mail->setDefaultFromPiwik();
            $mail->addTo($superUser['email']);
            $mail->setSubject($subject);
            $mail->setWrappedHtmlBody($message);
            $mail->send();
        }
    }
1147405
public function notify($to, $message)
    {
        $params = [
            'id'             => $to,
            'from'           => $this->config['from'],
            'message'        => $message,
            'notify'         => Arr::get($this->config, 'notify', false),
            'message_format' => Arr::get($this->config, 'format', 'text'),
        ];

        $color = Arr::get($this->config, 'color', 'yellow');

        if (!in_array($color, $this->colours)) {
            $color = 'yellow';
        }

        $params['color'] = $color;

        $type = Arr::get($this->config, 'type', 'message');

        return $this->send($this->buildUrlFromString("room/{$to}/{$type}"), $params);
    }
749113
public function send(SmsMessage $message, $to)
    {

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

        return false;
    }
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));
    }
861040
@Override
    public void sendMessage(String subject, String message) {
        first.sendMessage(subject, message);
        second.sendMessage(subject, message);
    }
1013643
public function endpoint_sendmessage($to = NULL, $from = NULL, $body = NULL)
        {
            return $this->sendmessage($to, $from, $body);
        }
1128878
public function send($send_to, $body, $title=null)
    {
        $sender = static::getSender();
        
        $tos = StringHelper::toArray($send_to);
        foreach ($tos as $email) {
            $sender->addTo($email);
        }
        
        $subject = $title;
        if ($title) {
            if (strlen($title) > strlen($body)) {
                $subject = $body;
                $body = $title;
            }
        } else {
            $subject = StringHelper::str_cut($body, 15);
        }
        
        $res = $sender->setSubject($subject)->setBody($body, true)->send();
        
        if (!$res) {
            return ErrorInfo::error('mail send error, check error log');
        }
        
        return ErrorInfo::success('mail send success');
    }
911850
protected function sendMessageTo($source, $from, $to, $subject, $body) {
		if($to instanceof Member) $to = $to->Email;
		$this->sendViaEmail($source, $from, $to, $subject, $body);
	}
632205
public static function sendEmail($toEmail, $subject, $body, $fromEmail)
    {
        $headers = "From: $fromEmail\r\n" .
            "Reply-To: $fromEmail\r\n" .
            "X-Mailer: PHP/" . phpversion();
        
        return mail($toEmail, $subject, $body, $headers);
    }